Skip to content

Commit

Permalink
Merge branch 'release/v2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
fuj1n committed Aug 7, 2020
2 parents c9c4db8 + e40d336 commit e4d3635
Show file tree
Hide file tree
Showing 35 changed files with 409 additions and 417 deletions.
9 changes: 6 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ repositories {
}
maven {
name "Tehnut Maven FS"
url "http://tehnut.info/maven"
url "http://maven.tehnut.info"
}
}

Expand Down Expand Up @@ -82,8 +82,11 @@ dependencies {
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")

compile fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}")

// Compile against the Hwyla API, but do not include it at runtime
compileOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}_${minecraft_version}:api")
// At runtime, use the full Hwyla jar
runtimeOnly fg.deobf("mcp.mobius.waila:Hwyla:${hwyla_version}_${minecraft_version}")
}

sourceSets {
Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mod_version=2.2.0
mod_version=2.2.1

minecraft_version=1.15.2
minecraft_version_short=1.15
minecraft_version=1.16.1
minecraft_version_short=1.16

forge_version=31.1.0
forge_version_toml=31
forge_version=32.0.106
forge_version_toml=32

mappings_channel=snapshot
mappings_version=20200423-1.15.1
mappings_version=20200723-1.16.1

mantle_version=1.5.15
mantle_version=1.6.21
tinkers_version=0
jei_version=6.0.0.3
jei_version=7.0.0.6

hwyla_version=1.10.8-B72_1.15.2
hwyla_version=1.10.10-B77
17 changes: 6 additions & 11 deletions src/main/java/slimeknights/tmechworks/TMechworks.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package slimeknights.tmechworks;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
Expand All @@ -19,25 +20,22 @@
import slimeknights.tmechworks.common.entities.MechworksFakePlayer;
import slimeknights.tmechworks.common.network.PacketHandler;

import java.nio.file.Path;
import java.nio.file.Paths;

@Mod(TMechworks.modId)
public class TMechworks {
public static final String modId = "tmechworks";
public static final String modName = "Tinkers' Mechworks";

public static final Path CONFIG_ROOT = Paths.get("config", "Tinkers Mechworks");

public static final Logger log = LogManager.getLogger(modId);

public static TMechworks instance;
public static CommonProxy proxy = DistExecutor.runForDist(()->()->new ClientProxy(), ()->()->new CommonProxy());
public static CommonProxy proxy = DistExecutor.safeRunForDist(()-> ClientProxy::new, ()-> CommonProxy::new);
public static MechworksContent content;

public TMechworks() {
instance = this;

ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, MechworksConfig.COMMON_SPEC);

IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();

bus.addListener(this::preInit);
Expand All @@ -48,17 +46,14 @@ public TMechworks() {
MinecraftForge.EVENT_BUS.addListener(MechworksFakePlayer::onWorldUnload);

content = new MechworksContent();
content.initRegisters();
bus.register(content);
}

private void preInit(final FMLCommonSetupEvent event) {
CONFIG_ROOT.toFile().mkdirs();
MechworksConfig.load();

proxy.preInit();

content.preInit(event);
DistExecutor.runWhenOn(Dist.CLIENT, () -> content::registerScreenFactories);

PacketHandler.register();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package slimeknights.tmechworks.api.disguisestate;

import net.minecraft.block.BlockState;
import net.minecraft.state.IProperty;
import net.minecraft.state.Property;

import java.util.Collection;

public abstract class BasicDisguiseState<T extends Comparable<T>> extends DisguiseState<T> {
private final IProperty<T> property;
private final Property<T> property;
private final T defaultValue;

public BasicDisguiseState(IProperty<T> property, T defaultValue) {
public BasicDisguiseState(Property<T> property, T defaultValue) {
this.property = property;
this.defaultValue = defaultValue;
}

@Override
public boolean canApplyTo(BlockState state) {
return state.has(property);
return state.hasProperty(property);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public ResourceLocation getIconSheet() {
}

@OnlyIn(Dist.CLIENT)
@SuppressWarnings("unchecked")
public final int unsafeGetIconFor(Object value) {
return getIconFor((T) value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class AxisFacingProvider extends FacingProvider {
@Override
public boolean canApplyTo(BlockState state, Direction facing) {
return state.has(BlockStateProperties.AXIS);
return state.hasProperty(BlockStateProperties.AXIS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class FacingExceptUpFacingProvider extends FacingProvider {
@Override
public boolean canApplyTo(BlockState state, Direction facing) {
return state.has(BlockStateProperties.FACING_EXCEPT_UP) && facing != Direction.UP;
return state.hasProperty(BlockStateProperties.FACING_EXCEPT_UP) && facing != Direction.UP;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class FacingProvider {
public boolean canApplyTo(BlockState state, Direction facing) {
return state.has(BlockStateProperties.FACING);
return state.hasProperty(BlockStateProperties.FACING);
}

public BlockState applyTo(BlockState state, Direction facing) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class HorizontalAxisFacingProvider extends FacingProvider {
@Override
public boolean canApplyTo(BlockState state, Direction facing) {
return state.has(BlockStateProperties.HORIZONTAL_AXIS) && facing != Direction.UP && facing != Direction.DOWN;
return state.hasProperty(BlockStateProperties.HORIZONTAL_AXIS) && facing != Direction.UP && facing != Direction.DOWN;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class HorizontalFacingProvider extends FacingProvider {
@Override
public boolean canApplyTo(BlockState state, Direction facing) {
return state.has(BlockStateProperties.HORIZONTAL_FACING) && facing != Direction.UP && facing != Direction.DOWN;
return state.hasProperty(BlockStateProperties.HORIZONTAL_FACING) && facing != Direction.UP && facing != Direction.DOWN;
}

@Override
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/slimeknights/tmechworks/client/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import slimeknights.mantle.client.book.BookLoader;
import slimeknights.mantle.client.book.data.BookData;
import slimeknights.mantle.client.book.repository.FileRepository;
import slimeknights.tmechworks.TMechworks;
import slimeknights.tmechworks.common.CommonProxy;
import slimeknights.tmechworks.common.MechworksContent;
import slimeknights.tmechworks.common.event.ModelBakeEventListener;
Expand All @@ -23,12 +26,14 @@ public void preInit() {
public void init() {
super.init();

registerDisguiseBlock(MechworksContent.Blocks.drawbridge);
registerDisguiseBlock(MechworksContent.Blocks.firestarter);
registerDisguiseBlock(MechworksContent.Blocks.drawbridge.get());
registerDisguiseBlock(MechworksContent.Blocks.firestarter.get());
}

@Override
public void setupClient() {
DistExecutor.runWhenOn(Dist.CLIENT, () -> TMechworks.content::registerScreenFactories);

// TODO mod config gui
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package slimeknights.tmechworks.client.gui;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.block.BlockState;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
Expand Down Expand Up @@ -31,15 +32,15 @@ public static DisguiseScreen create(DisguiseContainer container, PlayerInventory
protected void init() {
super.init();

disguiseWidget = new DisguiseStateWidget(guiLeft + 99, guiTop + 30, container.getTileEntity());
disguiseWidget = new DisguiseStateWidget(guiLeft + 99, guiTop + 30, container.getTile());
addButton(disguiseWidget);
}

@Override
public void tick() {
super.tick();

RedstoneMachineTileEntity te = container.getTileEntity();
RedstoneMachineTileEntity te = container.getTile();
ItemStack disguise = te.getDisguiseBlock();

if (disguise.getItem() instanceof BlockItem) {
Expand All @@ -51,27 +52,27 @@ public void tick() {
}

@Override
public void render(int mouseX, int mouseY, float partialTicks) {
this.renderBackground();
super.render(mouseX, mouseY, partialTicks);
this.renderHoveredToolTip(mouseX, mouseY);
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.func_230459_a_(matrixStack, mouseX, mouseY); // func_230459_a_ -> renderHoveredToolTip
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(SCREEN_LOCATION);

blit(guiLeft, guiTop, 0, 0, xSize, ySize); // Background
blit(matrixStack, guiLeft, guiTop, 0, 0, xSize, ySize); // Background
}

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
super.drawGuiContainerForegroundLayer(mouseX, mouseY);

String s = title.getFormattedText();
font.drawString(s, xSize / 2F - font.getStringWidth(s) / 2F, 6, 4210752);

font.drawString(playerInventory.getDisplayName().getFormattedText(), 8, ySize - 96 + 2, 4210752);
}
// @Override
// protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
// super.drawGuiContainerForegroundLayer(mouseX, mouseY);
//
// String s = title.getFormattedText();
// font.drawString(s, xSize / 2F - font.getStringWidth(s) / 2F, 6, 4210752);
//
// font.drawString(playerInventory.getDisplayName().getFormattedText(), 8, ySize - 96 + 2, 4210752);
// }
}
Loading

0 comments on commit e4d3635

Please sign in to comment.