forked from Martmists/YNet
22 changed files with 658 additions and 98 deletions
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.martmists.ynet; |
||||
|
||||
import com.martmists.ynet.screens.ControllerScreen; |
||||
import com.martmists.ynet.containers.ControllerContainer; |
||||
import net.fabricmc.api.ClientModInitializer; |
||||
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry; |
||||
import net.minecraft.util.Identifier; |
||||
|
||||
public class YNetModClient implements ClientModInitializer { |
||||
@Override |
||||
public void onInitializeClient() { |
||||
ScreenProviderRegistry.INSTANCE.registerFactory(new Identifier("ynet:controller"), (c) -> { |
||||
return new ControllerScreen((ControllerContainer) c); |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
package com.martmists.ynet.api; |
||||
|
||||
import net.minecraft.fluid.Fluid; |
||||
import net.minecraft.util.math.BlockPos; |
||||
import net.minecraft.world.BlockView; |
||||
|
||||
public interface FluidProvider extends BaseProvider { |
||||
int getFluidOutputCount(BlockView world, BlockPos pos); |
||||
Fluid getFluidOutput(BlockView world, BlockPos pos); |
||||
int getFluidInputCount(BlockView world, BlockPos pos, Fluid fluid); |
||||
void outputFluid(BlockView world, BlockPos pos, Fluid fluid, int amount); |
||||
void inputFluid(BlockView world, BlockPos pos, Fluid fluid, int amount); |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
package com.martmists.ynet.containers; |
||||
|
||||
import net.minecraft.entity.player.PlayerInventory; |
||||
import net.minecraft.util.PacketByteBuf; |
||||
import spinnery.common.BaseContainer; |
||||
import spinnery.widget.WInterface; |
||||
import spinnery.widget.WSlot; |
||||
|
||||
public class ControllerContainer extends BaseContainer { |
||||
public PlayerInventory playerInv; |
||||
public PacketByteBuf packet; |
||||
|
||||
public ControllerContainer(int synchronizationID, PlayerInventory linkedPlayerInventory, PacketByteBuf packet) { |
||||
super(synchronizationID, linkedPlayerInventory); |
||||
playerInv = linkedPlayerInventory; |
||||
this.packet = packet; |
||||
|
||||
WInterface mainInterface = getInterface(); |
||||
WSlot.addHeadlessPlayerInventory(mainInterface); |
||||
} |
||||
} |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
package com.martmists.ynet.event.impl; |
||||
|
||||
import com.martmists.ynet.api.EnergyProvider; |
||||
import com.martmists.ynet.blockentities.ControllerBlockEntity; |
||||
import com.martmists.ynet.event.ProviderTickCallback; |
||||
import com.martmists.ynet.network.ConnectorConfiguration; |
||||
import net.minecraft.world.World; |
||||
|
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.stream.Collectors; |
||||
|
||||
public class EnergyTickCallback implements ProviderTickCallback<EnergyProvider> { |
||||
@Override |
||||
public void interact(Set<ConnectorConfiguration> listeners, ControllerBlockEntity be) { |
||||
World world = be.getWorld(); |
||||
List<ConnectorConfiguration> takeEnergy = listeners.stream() |
||||
.filter(config -> config.state == ConnectorConfiguration.State.INPUT) |
||||
.sorted((a, b) -> a.priority >= b.priority ? 0 : 1) |
||||
.collect(Collectors.toList()); |
||||
List<ConnectorConfiguration> giveEnergy = listeners.stream() |
||||
.filter(config -> config.state == ConnectorConfiguration.State.OUTPUT) |
||||
.sorted((a, b) -> a.priority >= b.priority ? 0 : 1) |
||||
.collect(Collectors.toList()); |
||||
|
||||
double lastStored = 0.0; |
||||
double lastTaken = 0.0; |
||||
|
||||
while (!takeEnergy.isEmpty() && !giveEnergy.isEmpty()) { |
||||
|
||||
ConnectorConfiguration receiverConfig = takeEnergy.get(0); |
||||
ConnectorConfiguration providerConfig = giveEnergy.get(0); |
||||
EnergyProvider receiver = (EnergyProvider) world.getBlockState(receiverConfig.providerPos).getBlock(); |
||||
EnergyProvider provider = (EnergyProvider) world.getBlockState(providerConfig.providerPos).getBlock(); |
||||
|
||||
if (lastStored >= receiver.getEnergyInputLimit(world, receiverConfig.providerPos)) { |
||||
lastStored = 0.0; |
||||
try { |
||||
receiverConfig = takeEnergy.get(1); |
||||
} catch (IndexOutOfBoundsException exc) { |
||||
break; |
||||
} |
||||
receiver = (EnergyProvider) world.getBlockState(receiverConfig.providerPos); |
||||
takeEnergy.remove(0); |
||||
} |
||||
|
||||
if (lastTaken >= provider.getEnergyOutputLimit(world, providerConfig.providerPos)) { |
||||
lastTaken = 0.0; |
||||
try { |
||||
providerConfig = giveEnergy.get(1); |
||||
} catch (IndexOutOfBoundsException exc) { |
||||
break; |
||||
} |
||||
provider = (EnergyProvider) world.getBlockState(providerConfig.providerPos); |
||||
giveEnergy.remove(0); |
||||
} |
||||
|
||||
double toTransfer = Math.min( |
||||
receiver.getEnergyInputLimit(world, receiverConfig.providerPos), |
||||
provider.getEnergyOutputLimit(world, providerConfig.providerPos)); |
||||
|
||||
provider.outputEnergy(world, providerConfig.providerPos, toTransfer); |
||||
receiver.inputEnergy(world, receiverConfig.providerPos, toTransfer); |
||||
lastStored += toTransfer; |
||||
lastTaken += toTransfer; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,113 @@
@@ -0,0 +1,113 @@
|
||||
package com.martmists.ynet.event.impl; |
||||
|
||||
import com.martmists.ynet.api.FluidProvider; |
||||
import com.martmists.ynet.api.ItemProvider; |
||||
import com.martmists.ynet.blockentities.ControllerBlockEntity; |
||||
import com.martmists.ynet.event.ProviderTickCallback; |
||||
import com.martmists.ynet.network.ConnectorConfiguration; |
||||
import net.minecraft.fluid.Fluid; |
||||
import net.minecraft.fluid.Fluids; |
||||
import net.minecraft.item.ItemStack; |
||||
import net.minecraft.util.math.BlockPos; |
||||
import net.minecraft.world.World; |
||||
|
||||
import java.util.*; |
||||
import java.util.stream.Collectors; |
||||
|
||||
public class FluidTickCallback implements ProviderTickCallback<FluidProvider> { |
||||
@Override |
||||
public void interact(Set<ConnectorConfiguration> listeners, ControllerBlockEntity be) { |
||||
// Simple tuple class
|
||||
class Entry { |
||||
private final BlockPos pos; |
||||
private final FluidProvider provider; |
||||
private final Fluid fluid; |
||||
private int amount; |
||||
|
||||
Entry(BlockPos pos, FluidProvider provider, Fluid fluid, int amount) { |
||||
this.pos = pos; |
||||
this.provider = provider; |
||||
this.fluid = fluid; |
||||
this.amount = amount; |
||||
} |
||||
} |
||||
|
||||
World world = be.getWorld(); |
||||
List<ConnectorConfiguration> takeItems = listeners.stream() |
||||
.filter(config -> config.state == ConnectorConfiguration.State.INPUT) |
||||
.sorted((a, b) -> a.priority >= b.priority ? 0 : 1) |
||||
.collect(Collectors.toList()); |
||||
List<Entry> entries = new ArrayList<>(); |
||||
listeners.stream() |
||||
.filter(config -> config.state == ConnectorConfiguration.State.OUTPUT) |
||||
.sorted((a, b) -> a.priority >= b.priority ? 0 : 1) |
||||
.forEach(config -> { |
||||
FluidProvider p = (FluidProvider) world.getBlockState(config.providerPos).getBlock(); |
||||
Fluid f = p.getFluidOutput(world, config.providerPos); |
||||
if (f != Fluids.EMPTY) { |
||||
entries.add(new Entry(config.providerPos, p, f, p.getFluidOutputCount(world, config.providerPos))); |
||||
} |
||||
}); |
||||
|
||||
if (entries.isEmpty()) { |
||||
return; |
||||
} |
||||
|
||||
Entry e = entries.get(0); |
||||
|
||||
Map<FluidProvider, Integer> fluidsStored = new HashMap<>(); |
||||
Map<FluidProvider, Integer> fluidsRemoved = new HashMap<>(); |
||||
|
||||
while (!entries.isEmpty()) { |
||||
if (e.amount <= 0){ |
||||
try { |
||||
e = entries.get(1); |
||||
} catch (IndexOutOfBoundsException exc) { |
||||
break; |
||||
} |
||||
entries.remove(0); |
||||
} |
||||
|
||||
fluidsRemoved.putIfAbsent(e.provider, 0); |
||||
|
||||
if (fluidsRemoved.get(e.provider) >= 1000) { |
||||
e.amount = 0; |
||||
continue; |
||||
} |
||||
|
||||
boolean found = false; |
||||
for (ConnectorConfiguration receiverConfig : takeItems){ |
||||
FluidProvider receiver = (FluidProvider) world.getBlockState(receiverConfig.providerPos).getBlock(); |
||||
fluidsStored.putIfAbsent(receiver, 0); |
||||
int count = Math.min( |
||||
receiver.getFluidInputCount(world, receiverConfig.providerPos, e.fluid), |
||||
Math.min( |
||||
1000 - fluidsStored.get(receiver), |
||||
1000 - fluidsRemoved.get(e.provider))); |
||||
|
||||
if (receiverConfig.filter != null) { |
||||
Entry fe = e; |
||||
if (Arrays.stream(receiverConfig.filter).noneMatch((obj) -> obj == fe.fluid)){ |
||||
continue; |
||||
} |
||||
} |
||||
|
||||
if (count > 0){ |
||||
fluidsStored.put(receiver, fluidsStored.get(receiver) + count); |
||||
fluidsRemoved.put(e.provider, fluidsRemoved.get(e.provider) + count); |
||||
int finalCount = e.amount - count; |
||||
e.amount = count; |
||||
e.provider.outputFluid(world, e.pos, e.fluid, e.amount); |
||||
receiver.inputFluid(world, e.pos, e.fluid, e.amount); |
||||
e.amount = finalCount; |
||||
found = true; |
||||
} |
||||
} |
||||
|
||||
if (!found) { |
||||
// Remove next
|
||||
e.amount = 0; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
package com.martmists.ynet.mixin.providers.fluid; |
||||
|
||||
import com.martmists.ynet.api.FluidProvider; |
||||
import net.minecraft.fluid.Fluid; |
||||
import net.minecraft.util.math.BlockPos; |
||||
import net.minecraft.world.BlockView; |
||||
import org.spongepowered.asm.mixin.Mixin; |
||||
import reborncore.common.blocks.BlockMachineBase; |
||||
|
||||
@Mixin(BlockMachineBase.class) |
||||
public class BlockMachineBaseMixin implements FluidProvider { |
||||
|
||||
@Override |
||||
public int getFluidOutputCount(BlockView world, BlockPos pos) { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public Fluid getFluidOutput(BlockView world, BlockPos pos) { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public int getFluidInputCount(BlockView world, BlockPos pos, Fluid fluid) { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public void outputFluid(BlockView world, BlockPos pos, Fluid fluid, int amount) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void inputFluid(BlockView world, BlockPos pos, Fluid fluid, int amount) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,251 @@
@@ -0,0 +1,251 @@
|
||||
package com.martmists.ynet.screens; |
||||
|
||||
import com.martmists.ynet.YNetMod; |
||||
import com.martmists.ynet.api.BaseProvider; |
||||
import com.martmists.ynet.blockentities.ControllerBlockEntity; |
||||
import com.martmists.ynet.containers.ControllerContainer; |
||||
import com.martmists.ynet.network.Channel; |
||||
import com.martmists.ynet.network.ConnectorConfiguration; |
||||
import net.minecraft.client.render.item.ItemRenderer; |
||||
import net.minecraft.entity.player.PlayerEntity; |
||||
import net.minecraft.item.ItemStack; |
||||
import net.minecraft.text.LiteralText; |
||||
import net.minecraft.text.TranslatableText; |
||||
import net.minecraft.util.math.BlockPos; |
||||
import spinnery.client.BaseRenderer; |
||||
import spinnery.common.BaseContainerScreen; |
||||
import spinnery.widget.*; |
||||
import spinnery.widget.api.Position; |
||||
import spinnery.widget.api.Size; |
||||
import spinnery.widget.api.WVerticalScrollable; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
import java.util.stream.Collectors; |
||||
|
||||
public class ControllerScreen extends BaseContainerScreen<ControllerContainer> { |
||||
private final ControllerBlockEntity sourceBlockEntity; |
||||
private int channelNum; |
||||
private Channel currentChannel; |
||||
private ConnectorConfiguration currentConfig; |
||||
private WButton[] channelButtons = new WButton[9]; |
||||
private WButton configButtonClicked; |
||||
|
||||
private static List<Class<? extends BaseProvider>> TYPE_LOOP = new ArrayList<>(YNetMod.PROVIDER_NAMES.keySet()); |
||||
|
||||
static { |
||||
TYPE_LOOP.add(null); |
||||
} |
||||
|
||||
public ControllerScreen(ControllerContainer linkedContainer) { |
||||
super(new LiteralText(""), linkedContainer, linkedContainer.getPlayerInventory().player); |
||||
PlayerEntity player = linkedContainer.getPlayerInventory().player; |
||||
this.sourceBlockEntity = (ControllerBlockEntity) player.world.getBlockEntity(linkedContainer.packet.readBlockPos()); |
||||
assert sourceBlockEntity != null; |
||||
|
||||
WInterface mainInterface = getInterface(); |
||||
WPanel mainPanel = mainInterface.createChild( |
||||
WPanel.class, |
||||
Position.of(0, 0, 0), |
||||
Size.of(320, 155) |
||||
); |
||||
mainPanel.center(); |
||||
|
||||
WPanel channelSettingsPanel = mainPanel.createChild( |
||||
WPanel.class, |
||||
Position.of(mainPanel, 169, 5, 100), |
||||
Size.of(145, 73) |
||||
); |
||||
|
||||
channelNum = 0; |
||||
currentChannel = sourceBlockEntity.channels[0]; |
||||
channelSettingsPanel.setLabel("Channel 1"); |
||||
|
||||
channelSettingsPanel.createChild( |
||||
WStaticText.class, |
||||
Position.of(channelSettingsPanel, 4, 22), |
||||
Size.of(2, 20) |
||||
).setText("Mode:"); |
||||
WButton channelTypeButton = channelSettingsPanel.createChild( |
||||
WButton.class, |
||||
Position.of(channelSettingsPanel, 40, 20), |
||||
Size.of(100, 14) |
||||
); |
||||
channelTypeButton.setLabel("Disabled"); |
||||
channelTypeButton.setOnMouseClicked((WButton w, int mouseX, int mouseY, int mouseButton) -> { |
||||
if (channelSettingsPanel.getZ() != 100){ |
||||
return; |
||||
} |
||||
int currentIndex = TYPE_LOOP.indexOf((currentChannel != null) ? currentChannel.providerType : null); |
||||
Class<? extends BaseProvider> nextType; |
||||
try { |
||||
nextType = TYPE_LOOP.get(currentIndex + ((mouseButton == 0) ? 1 : -1)); |
||||
} catch (IndexOutOfBoundsException e) { |
||||
nextType = TYPE_LOOP.get((mouseButton == 0) ? 0 : TYPE_LOOP.size()-1); |
||||
} |
||||
if (TYPE_LOOP.get(currentIndex) == null) { |
||||
currentChannel = new Channel(); |
||||
} |
||||
currentChannel.providerType = nextType; |
||||
sourceBlockEntity.channels[channelNum] = currentChannel; |
||||
if (nextType == null) { |
||||
currentChannel = null; |
||||
channelButtons[channelNum].overrideStyle("background.on", 0xff8b8b8b); |
||||
channelButtons[channelNum].overrideStyle("background.off", 0xff8b8b8b); |
||||
} else { |
||||
channelButtons[channelNum].overrideStyle("background.on", YNetMod.COLOR_MAP.get(nextType)); |
||||
channelButtons[channelNum].overrideStyle("background.off", YNetMod.COLOR_MAP.get(nextType)); |
||||
} |
||||
channelTypeButton.setLabel(YNetMod.PROVIDER_NAMES.getOrDefault(nextType, "Disabled")); |
||||
}); |
||||
|
||||
WPanel connectorSettingsPanel = mainPanel.createChild( |
||||
WPanel.class, |
||||
Position.of(mainPanel, 169, 5, 0), |
||||
Size.of(145, 73) |
||||
); |
||||
connectorSettingsPanel.setLabel("Connector settings"); |
||||
connectorSettingsPanel.createChild( |
||||
WStaticText.class, |
||||
Position.of(connectorSettingsPanel, 4, 22), |
||||
Size.of(2, 20) |
||||
).setText("Mode:"); |
||||
WButton stateButton = connectorSettingsPanel.createChild( |
||||
WButton.class, |
||||
Position.of(connectorSettingsPanel, 40, 20), |
||||
Size.of(100, 14) |
||||
); |
||||
stateButton.setOnMouseClicked((WButton w, int mouseX, int mouseY, int mouseButton) -> { |
||||
if (connectorSettingsPanel.getZ() != 100){ |
||||
return; |
||||
} |
||||
ConnectorConfiguration.State nextState; |
||||
switch (currentConfig.state) { |
||||
case DISABLED: |
||||
nextState = ConnectorConfiguration.State.INPUT; |
||||
break; |
||||
case INPUT: |
||||
nextState = ConnectorConfiguration.State.OUTPUT; |
||||
break; |
||||
case OUTPUT: |
||||
nextState = ConnectorConfiguration.State.DISABLED; |
||||
break; |
||||
default: |
||||
throw new IllegalStateException("Unexpected value: " + currentConfig.state); |
||||
} |
||||
currentConfig.state = nextState; |
||||
stateButton.setLabel(nextState.name()); |
||||
if (currentConfig.state != ConnectorConfiguration.State.DISABLED) { |
||||
configButtonClicked.setLabel((currentConfig.state == ConnectorConfiguration.State.INPUT) ? "I" : "O"); |
||||
int inputColor = 0xff0077be; |
||||
int outputColor = 0xffffcc99; |
||||
configButtonClicked.overrideStyle("background.on", (currentConfig.state == ConnectorConfiguration.State.INPUT) ? inputColor : outputColor); |
||||
configButtonClicked.overrideStyle("background.off", (currentConfig.state == ConnectorConfiguration.State.INPUT) ? inputColor : outputColor); |
||||
} else { |
||||
configButtonClicked.overrideStyle("background.on", 0xff8b8b8b); |
||||
configButtonClicked.overrideStyle("background.off", 0xff8b8b8b); |
||||
} |
||||
}); |
||||
|
||||
for (int i = 0; i < 9; i++){ |
||||
int f = i; |
||||
WButton button = mainPanel.createChild( |
||||
WButton.class, |
||||
Position.of(mainPanel, 25 + 14*i, 5), |
||||
Size.of(12, 14) |
||||
); |
||||
channelButtons[f] = button; |
||||
button.setLabel(Integer.toString(i+1)); |
||||
button.setOnMouseClicked((WButton widget, int mouseX, int mouseY, int mouseButton) -> { |
||||
currentChannel = sourceBlockEntity.channels[f]; |
||||
connectorSettingsPanel.setZ(0); |
||||
channelSettingsPanel.setZ(100); |
||||
|
||||
channelNum = f; |
||||
channelSettingsPanel.setLabel("Channel " + (f + 1)); |
||||
|
||||
if (currentChannel != null) { |
||||
channelTypeButton.setLabel(new TranslatableText(YNetMod.PROVIDER_NAMES.get(currentChannel.providerType))); |
||||
} |
||||
}); |
||||
|
||||
if (sourceBlockEntity.channels[i] != null) { |
||||
button.overrideStyle("background.on", YNetMod.COLOR_MAP.get(sourceBlockEntity.channels[i].providerType)); |
||||
button.overrideStyle("background.off", YNetMod.COLOR_MAP.get(sourceBlockEntity.channels[i].providerType)); |
||||
} |
||||
} |
||||
|
||||
WVerticalScrollableContainer blockList = mainPanel.createChild( |
||||
WVerticalScrollableContainer.class, |
||||
Position.of(mainPanel, 4, 20), |
||||
Size.of(163, 130) |
||||
); |
||||
|
||||
Set<BlockPos> blocksToShow = sourceBlockEntity.network.getProviders(player.world); |
||||
int i = 0; |
||||
for (BlockPos p : blocksToShow) { |
||||
WPanel row = blockList.createChild( |
||||
WPanel.class, |
||||
Position.of(blockList, 0, 26*i), |
||||
Size.of(154, 25) |
||||
); |
||||
i++; |
||||
WItem item = row.createChild( |
||||
WItem.class, |
||||
Position.of(row, 4, 4), |
||||
Size.of(16, 16) |
||||
); |
||||
item.setItemStack(new ItemStack(player.world.getBlockState(p).getBlock().asItem())); |
||||
|
||||
for (int j = 0; j < 9; j++){ |
||||
int k = j; |
||||
WButton button = row.createChild( |
||||
WButton.class, |
||||
Position.of(row, 21 + 14*j, 5), |
||||
Size.of(12, 14) |
||||
); |
||||
// Get configuration for block in channel
|
||||
Channel channel = sourceBlockEntity.channels[j]; |
||||
|
||||
if (channel != null) { |
||||
ConnectorConfiguration config = channel.connectorSettings.stream().filter((s) -> s.providerPos == p).findFirst().orElse(null); |
||||
if (config == null) { |
||||
config = new ConnectorConfiguration(); |
||||
config.providerPos = p; |
||||
channel.connectorSettings.add(config); |
||||
} |
||||
|
||||
if (config.state != ConnectorConfiguration.State.DISABLED) { |
||||
button.setLabel((config.state == ConnectorConfiguration.State.INPUT) ? "I" : "O"); |
||||
int inputColor = 0xff0077be; |
||||
int outputColor = 0xffffcc99; |
||||
button.overrideStyle("background.on", (config.state == ConnectorConfiguration.State.INPUT) ? inputColor : outputColor); |
||||
button.overrideStyle("background.off", (config.state == ConnectorConfiguration.State.INPUT) ? inputColor : outputColor); |
||||
} else { |
||||
button.overrideStyle("background.on", 0xff8b8b8b); |
||||
button.overrideStyle("background.off", 0xff8b8b8b); |
||||
} |
||||
} |
||||
|
||||
button.setOnMouseClicked((WButton widget, int mouseX, int mouseY, int mouseButton) -> { |
||||
if (sourceBlockEntity.channels[k] != null) { |
||||
currentConfig = sourceBlockEntity.channels[k].connectorSettings.stream().filter((s) -> s.providerPos == p).findFirst().orElse(null); |
||||
if (currentConfig == null) { |
||||
currentConfig = new ConnectorConfiguration(); |
||||
currentConfig.providerPos = p; |
||||
sourceBlockEntity.channels[k].connectorSettings.add(currentConfig); |
||||
} |
||||
stateButton.setLabel(currentConfig.state.name()); |
||||
connectorSettingsPanel.setZ(100); |
||||
channelSettingsPanel.setZ(0); |
||||
configButtonClicked = button; |
||||
} |
||||
}); |
||||
|
||||
} |
||||
} |
||||
|
||||
WSlot.addPlayerInventory(Position.of(mainPanel, 170, 83, 1), Size.of(16, 16), mainInterface); |
||||
} |
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package spinnery.widget; |
||||
|
||||
import net.minecraft.item.ItemStack; |
||||
import spinnery.client.BaseRenderer; |
||||
|
||||
public class WItem extends WAbstractWidget { |
||||
private ItemStack itemStack; |
||||
|
||||
@Override |
||||
public void draw() { |
||||
BaseRenderer.getItemRenderer().renderGuiItem(itemStack, getX(), getY()); |
||||
} |
||||
|
||||
public void setItemStack(ItemStack itemStack) { |
||||
this.itemStack = itemStack; |
||||
} |
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
{ |
||||
"parent": "ynet:block/cable", |
||||
"display": { |
||||
"thirdperson_righthand": { |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"thirdperson_lefthand": { |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"firstperson_righthand": { |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"firstperson_lefthand": { |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"gui": { |
||||
"rotation": [30, -135, 0], |
||||
"scale": [1.5, 1.5, 1.5] |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
{ |
||||
"parent": "ynet:block/connector", |
||||
"display": { |
||||
"thirdperson_righthand": { |
||||
"rotation": [-180, 0, 0], |
||||
"translation": [0, -2.5, 0], |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"thirdperson_lefthand": { |
||||
"rotation": [-180, 0, 0], |
||||
"translation": [0, -2.5, 0], |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"firstperson_righthand": { |
||||
"rotation": [-180, 0, 0], |
||||
"translation": [0, -2.5, 0], |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"firstperson_lefthand": { |
||||
"rotation": [-180, 0, 0], |
||||
"translation": [0, -2.5, 0], |
||||
"scale": [0.5, 0.5, 0.5] |
||||
}, |
||||
"ground": { |
||||
"rotation": [90, 0, 0], |
||||
"translation": [0, 0, 5] |
||||
}, |
||||
"gui": { |
||||
"rotation": [30, -135, 90], |
||||
"translation": [4, 2, 0] |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue