-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed some resource station issues and added livestock pen screen
- Loading branch information
1 parent
1a9832e
commit 9624b9a
Showing
28 changed files
with
348 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/industrialwarfare/models/item/animal_feed.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "industrialwarfare:item/animal_feed" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...n/java/rbasamoyai/industrialwarfare/client/screen/resourcestation/LivestockPenScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package rbasamoyai.industrialwarfare.client.screen.resourcestation; | ||
|
||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.TextComponent; | ||
import net.minecraft.network.chat.TranslatableComponent; | ||
import net.minecraft.world.entity.player.Inventory; | ||
import net.minecraftforge.client.gui.widget.ForgeSlider; | ||
import rbasamoyai.industrialwarfare.IndustrialWarfare; | ||
import rbasamoyai.industrialwarfare.client.screen.widgets.WidgetUtils; | ||
import rbasamoyai.industrialwarfare.common.containers.resourcestation.LivestockPenMenu; | ||
import rbasamoyai.industrialwarfare.core.network.IWNetwork; | ||
import rbasamoyai.industrialwarfare.core.network.messages.ResourceStationMessages.SSyncLivestockCount; | ||
|
||
public class LivestockPenScreen extends ResourceStationScreen<LivestockPenMenu> { | ||
|
||
private static final int TOP_MENU_START_X = 7; | ||
private static final int TOP_MENU_START_Y = 17; | ||
|
||
private ForgeSlider countSlider; | ||
|
||
public LivestockPenScreen(LivestockPenMenu menu, Inventory playerInv, Component title) { | ||
super(menu, playerInv, title); | ||
} | ||
|
||
@Override | ||
protected void init() { | ||
super.init(); | ||
this.countSlider = this.addRenderableWidget(new ForgeSlider( | ||
this.leftPos + TOP_MENU_START_X + 62, | ||
this.topPos + TOP_MENU_START_Y + 30, | ||
100, 20, | ||
new TranslatableComponent("gui." + IndustrialWarfare.MOD_ID + ".livestock_pen.minimum_livestock"), | ||
TextComponent.EMPTY, | ||
2, 16, | ||
this.menu.getMinimumLivestock(), | ||
true)); | ||
WidgetUtils.setActiveAndVisible(this.countSlider, this.menu.getSelected() == 0); | ||
} | ||
|
||
@Override | ||
public void containerTick() { | ||
super.containerTick(); | ||
|
||
int tab = this.menu.getSelected(); | ||
WidgetUtils.setActiveAndVisible(this.countSlider, tab == 0); | ||
if (tab == 0) { | ||
int count = this.countSlider.getValueInt(); | ||
boolean flag = this.menu.getMinimumLivestock() != count; | ||
if (flag) { | ||
this.menu.setMinimumLivestock(count); | ||
IWNetwork.CHANNEL.sendToServer(new SSyncLivestockCount(count)); | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.