Merge remote-tracking branch 'remotes/origin/1.15' into 1.16

# Conflicts:
#	build.gradle
This commit is contained in:
modmuss50 2020-04-11 15:40:23 +01:00
commit c2e74f070d
7 changed files with 92 additions and 3 deletions

View file

@ -43,6 +43,13 @@ repositories {
//Dev Mode
url "https://maven.jamieswhiteshirt.com/libs-release/"
}
maven {
//trinkets
url = "https://maven.abusedmaster.xyz/"
}
maven {
url = "https://jitpack.io"
}
}
version = "3.3.8"
@ -74,6 +81,7 @@ dependencies {
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.1.1-unstable")
disabledOptionalDependency ('io.github.cottonmc:LibCD:2.3.0+1.15.2')
disabledOptionalDependency ('com.github.emilyploszaj:trinkets:2.4.2')
def rcVersion = 'RebornCore:RebornCore-1.16:+'
modApi (rcVersion) {

View file

@ -26,6 +26,9 @@ package techreborn;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.ComposterBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
@ -39,6 +42,7 @@ import reborncore.common.util.Torus;
import reborncore.common.world.DataAttachment;
import techreborn.blockentity.storage.energy.idsu.IDSUManager;
import techreborn.client.GuiType;
import techreborn.compat.trinkets.Trinkets;
import techreborn.config.TechRebornConfig;
import techreborn.events.ModRegistry;
import techreborn.init.FluidGeneratorRecipes;
@ -54,6 +58,8 @@ import techreborn.packets.ServerboundPackets;
import techreborn.utils.PoweredCraftingHandler;
import techreborn.world.WorldGenerator;
import java.util.function.Predicate;
public class TechReborn implements ModInitializer {
public static final String MOD_ID = "techreborn";
@ -64,6 +70,8 @@ public class TechReborn implements ModInitializer {
new Identifier("techreborn", "item_group"),
() -> new ItemStack(TRContent.NUKE));
public static Predicate<PlayerEntity> elytraPredicate = playerEntity -> false;
@Override
public void onInitialize() {
INSTANCE = this;
@ -96,6 +104,17 @@ public class TechReborn implements ModInitializer {
RedstoneConfiguration.fluidStack = DynamicCellItem.getCellWithFluid(Fluids.LAVA);
RedstoneConfiguration.powerStack = new ItemStack(TRContent.RED_CELL_BATTERY);
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.RUBBER_SAPLING.asItem(), 0.3F);
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.RUBBER_LEAVES.asItem(), 0.3F);
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.Parts.PLANTBALL.asItem(), 1F);
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.Parts.COMPRESSED_PLANTBALL.asItem(), 1F);
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.Dusts.SAW.asItem(), 0.3F);
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.put(TRContent.SmallDusts.SAW.asItem(), 0.1F);
if (FabricLoader.getInstance().isModLoaded("trinkets")) {
elytraPredicate = Trinkets.isElytraEquipped();
}
LOGGER.info("TechReborn setup done!");
}

View file

@ -24,6 +24,9 @@
package techreborn.compat.rei;
import me.shedaniel.math.api.Rectangle;
import me.shedaniel.rei.api.BaseBoundsHandler;
import me.shedaniel.rei.api.DisplayHelper;
import me.shedaniel.rei.api.EntryRegistry;
import me.shedaniel.rei.api.EntryStack;
import me.shedaniel.rei.api.RecipeDisplay;
@ -31,9 +34,14 @@ import me.shedaniel.rei.api.RecipeHelper;
import me.shedaniel.rei.api.plugins.REIPluginV0;
import net.fabricmc.loader.api.SemanticVersion;
import net.fabricmc.loader.util.version.VersionParsingException;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.item.ItemConvertible;
import net.minecraft.recipe.Recipe;
import net.minecraft.util.Identifier;
import reborncore.api.blockentity.IUpgradeable;
import reborncore.client.gui.builder.GuiBase;
import reborncore.client.gui.builder.slot.GuiTab;
import reborncore.common.crafting.RebornRecipe;
import reborncore.common.crafting.RebornRecipeType;
import reborncore.common.crafting.RecipeManager;
@ -52,6 +60,7 @@ import techreborn.init.ModRecipes;
import techreborn.init.TRContent;
import techreborn.init.TRContent.Machine;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
@ -206,4 +215,32 @@ public class ReiPlugin implements REIPluginV0 {
return false;
}, recipeDisplay);
}
@Override
public void registerBounds(DisplayHelper displayHelper) {
BaseBoundsHandler baseBoundsHandler = BaseBoundsHandler.getInstance();
baseBoundsHandler.registerExclusionZones(GuiBase.class, () -> {
Screen currentScreen = MinecraftClient.getInstance().currentScreen;
if (currentScreen instanceof GuiBase) {
GuiBase<?> guiBase = (GuiBase<?>) currentScreen;
int height = 0;
if (guiBase.tryAddUpgrades() && guiBase.be instanceof IUpgradeable) {
IUpgradeable upgradeable = (IUpgradeable) guiBase.be;
if (upgradeable.canBeUpgraded()) {
height = 80;
}
}
for (GuiTab slot : guiBase.getTabs()) {
if (slot.enabled()) {
height += 24;
}
}
if (height > 0) {
int width = 20;
return Collections.singletonList(new Rectangle(guiBase.getGuiLeft() - width, guiBase.getGuiTop() + 8, width , height));
}
}
return Collections.emptyList();
});
}
}

View file

@ -0,0 +1,23 @@
package techreborn.compat.trinkets;
import dev.emi.trinkets.api.TrinketComponent;
import dev.emi.trinkets.api.TrinketsApi;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import java.util.function.Predicate;
public class Trinkets {
public static Predicate<PlayerEntity> isElytraEquipped() {
return playerEntity -> {
TrinketComponent component = TrinketsApi.getTrinketComponent(playerEntity);
for (int i = 0; i < component.getInventory().getInvSize(); i++) {
if (component.getInventory().getInvStack(i).getItem() == Items.ELYTRA) {
return true;
}
}
return false;
};
}
}

View file

@ -93,7 +93,7 @@ public class QuantumSuitItem extends TRArmourItem implements ItemStackModifiers,
}
break;
case CHEST:
if (Energy.of(stack).getEnergy() > flyCost) {
if (Energy.of(stack).getEnergy() > flyCost && !TechReborn.elytraPredicate.test(playerEntity)) {
playerEntity.abilities.allowFlying = true;
if (playerEntity.abilities.flying) {
Energy.of(stack).use(flyCost);

View file

@ -71,7 +71,7 @@ public class FluidUtils {
FluidValue freeSpace = target.getCapacity(null).subtract(targetFluidInstance.getAmount());
if(!outputStack.isEmpty()){
if(outputStack.getCount() >= outputStack.getMaxCount()){
if(outputStack.getCount() >= outputStack.getMaxCount() || !outputStack.isItemEqual(itemFluidInfo.getEmpty())){
return false;
}
}
@ -109,7 +109,9 @@ public class FluidUtils {
if(!outputStack.isEmpty()){
if (outputStack.getCount() >= outputStack.getMaxCount()) return false;
if(!(outputStack.getItem() instanceof ItemFluidInfo)) return false;
if (!(outputStack.getItem() instanceof ItemFluidInfo)) return false;
if (!outputStack.isItemEqual(itemFluidInfo.getEmpty())) return false;
ItemFluidInfo outputFluidInfo = (ItemFluidInfo) outputStack.getItem();