20w18a
This commit is contained in:
parent
bc98f2f758
commit
862db8a4ab
14 changed files with 112 additions and 59 deletions
|
@ -72,14 +72,14 @@ license {
|
|||
group = 'TechReborn'
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:20w17a"
|
||||
mappings "net.fabricmc:yarn:20w17a+build.5:v2"
|
||||
minecraft "com.mojang:minecraft:20w18a"
|
||||
mappings "net.fabricmc:yarn:20w18a+build.14:v2"
|
||||
modImplementation "net.fabricmc:fabric-loader:0.8.2+build.194"
|
||||
|
||||
//Fabric api
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.6.2+build.327-1.16"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.10.2+build.337-1.16"
|
||||
|
||||
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.2.0-unstable")
|
||||
optionalDependency ("me.shedaniel:RoughlyEnoughItems:4.3.1-unstable")
|
||||
disabledOptionalDependency ('io.github.cottonmc:LibCD:2.3.0+1.15.2')
|
||||
disabledOptionalDependency ('com.github.emilyploszaj:trinkets:2.4.2')
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.fabricmc.api.ClientModInitializer;
|
|||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||
import net.minecraft.client.item.ModelPredicateProvider;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
|
@ -37,14 +38,20 @@ import net.minecraft.client.render.model.UnbakedModel;
|
|||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.ModelIdentifier;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import reborncore.client.gui.builder.GuiBase;
|
||||
import reborncore.client.hud.StackInfoHUD;
|
||||
import reborncore.client.multiblock.MultiblockRenderer;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.mixin.client.AccessorModelPredicateProviderRegistry;
|
||||
import team.reborn.energy.Energy;
|
||||
import techreborn.client.render.DynamicBucketBakedModel;
|
||||
import techreborn.client.render.DynamicCellBakedModel;
|
||||
import techreborn.client.render.entitys.CableCoverRenderer;
|
||||
|
@ -54,15 +61,21 @@ import techreborn.events.StackToolTipHandler;
|
|||
import techreborn.init.ModFluids;
|
||||
import techreborn.init.TRBlockEntities;
|
||||
import techreborn.init.TRContent;
|
||||
import techreborn.items.BatteryItem;
|
||||
import techreborn.items.DynamicCellItem;
|
||||
import techreborn.items.FrequencyTransmitterItem;
|
||||
import techreborn.items.armor.BatpackItem;
|
||||
import techreborn.items.tool.ChainsawItem;
|
||||
import techreborn.items.tool.industrial.NanosaberItem;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class TechRebornClient implements ClientModInitializer {
|
||||
|
||||
|
@ -160,7 +173,83 @@ public class TechRebornClient implements ClientModInitializer {
|
|||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.STORAGE_UNIT, StorageUnitRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.CABLE, CableCoverRenderer::new);
|
||||
BlockEntityRendererRegistry.INSTANCE.register(TRBlockEntities.WIND_MILL, TurbineRenderer::new);
|
||||
|
||||
registerPredicateProvider(
|
||||
BatpackItem.class,
|
||||
new Identifier("techreborn:empty"),
|
||||
(item, stack, world, entity) -> {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
);
|
||||
|
||||
registerPredicateProvider(
|
||||
BatteryItem.class,
|
||||
new Identifier("techreborn:empty"),
|
||||
(item, stack, world, entity) -> {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
);
|
||||
|
||||
registerPredicateProvider(
|
||||
FrequencyTransmitterItem.class,
|
||||
new Identifier("techreborn:coords"),
|
||||
(item, stack, world, entity) -> {
|
||||
if (!stack.isEmpty() && stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x")
|
||||
&& stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
);
|
||||
|
||||
registerPredicateProvider(
|
||||
ChainsawItem.class,
|
||||
new Identifier("techreborn:animated"),
|
||||
(item, stack, world, entity) -> {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() >= item.getCost() && entity != null && entity.getMainHandStack().equals(stack)) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
);
|
||||
|
||||
registerPredicateProvider(
|
||||
NanosaberItem.class,
|
||||
new Identifier("techreborn:active"),
|
||||
(item, stack, world, entity) -> {
|
||||
if (ItemUtils.isActive(stack)) {
|
||||
if (Energy.of(stack).getMaxStored() - Energy.of(stack).getEnergy() >= 0.9 * Energy.of(stack).getMaxStored()) {
|
||||
return 0.5F;
|
||||
}
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private static <T extends Item> void registerPredicateProvider(Class<T> itemClass, Identifier identifier, ItemModelPredicateProvider<T> modelPredicateProvider) {
|
||||
Registry.ITEM.stream()
|
||||
.filter(item -> item.getClass().isAssignableFrom(itemClass))
|
||||
.forEach(item -> AccessorModelPredicateProviderRegistry.callRegister(item, identifier, modelPredicateProvider));
|
||||
}
|
||||
|
||||
//Need the item instance in a few places, this makes it easier
|
||||
private interface ItemModelPredicateProvider<T extends Item> extends ModelPredicateProvider {
|
||||
|
||||
float call(T item, ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity);
|
||||
|
||||
@Override
|
||||
default float call(ItemStack stack, @Nullable ClientWorld world, @Nullable LivingEntity entity) {
|
||||
return call((T) stack.getItem(), stack, world, entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class GuiAutoCrafting extends GuiBase<BuiltScreenHandler> {
|
|||
}
|
||||
drawOutputSlot(matrixStack, 145, 42, layer);
|
||||
drawOutputSlot(matrixStack, 95, 42, layer);
|
||||
method_27534(matrixStack, client.textRenderer, new LiteralText("Inventory"), 8, 82, 4210752);
|
||||
drawStringWithShadow(matrixStack, client.textRenderer, new LiteralText("Inventory"), 8, 82, 4210752);
|
||||
|
||||
builder.drawLockButton(matrixStack, this, 145, 4, mouseX, mouseY, layer, blockEntityAutoCraftingTable.locked);
|
||||
}
|
||||
|
|
|
@ -92,10 +92,10 @@ public class GuiManual extends Screen {
|
|||
int centerX = (width / 2) - guiWidth / 2;
|
||||
int centerY = (height / 2) - guiHeight / 2;
|
||||
drawTexture(matrixStack, centerX, centerY, 0, 0, guiWidth, guiHeight);
|
||||
textRenderer.draw(matrixStack, text1, ((width / 2) - textRenderer.getWidth(text1) / 2), centerY + 40, 4210752);
|
||||
textRenderer.draw(matrixStack, text2, ((width / 2) - textRenderer.getWidth(text2) / 2), centerY + 90, 4210752);
|
||||
textRenderer.draw(matrixStack, text1, ((width / 2) - textRenderer.getStringWidth(text1) / 2), centerY + 40, 4210752);
|
||||
textRenderer.draw(matrixStack, text2, ((width / 2) - textRenderer.getStringWidth(text2) / 2), centerY + 90, 4210752);
|
||||
if (TechRebornConfig.allowManualRefund) {
|
||||
textRenderer.draw(matrixStack, text3, ((width / 2) - textRenderer.getWidth(text3) / 2), centerY + 140, 4210752);
|
||||
textRenderer.draw(matrixStack, text3, ((width / 2) - textRenderer.getStringWidth(text3) / 2), centerY + 140, 4210752);
|
||||
}
|
||||
super.render(matrixStack, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@ public class GuiTankUnit extends GuiBase<BuiltScreenHandler> {
|
|||
super.drawBackground(matrixStack, f, mouseX, mouseY);
|
||||
final GuiBase.Layer layer = GuiBase.Layer.BACKGROUND;
|
||||
|
||||
method_27534(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752);
|
||||
drawStringWithShadow(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.in"), 100, 43, 4210752);
|
||||
drawSlot(matrixStack, 100, 53, layer);
|
||||
|
||||
method_27534(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752);
|
||||
drawStringWithShadow(matrixStack, client.textRenderer, new TranslatableText("gui.techreborn.unit.out"), 140, 43, 4210752);
|
||||
drawSlot(matrixStack, 140, 53, layer);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraft.client.MinecraftClient;
|
|||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.render.model.json.ModelItemPropertyOverrideList;
|
||||
import net.minecraft.client.render.model.json.ModelOverrideList;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.ModelIdentifier;
|
||||
|
@ -130,8 +130,8 @@ public abstract class BaseDynamicFluidBakedModel implements BakedModel, FabricBa
|
|||
}
|
||||
|
||||
@Override
|
||||
public ModelItemPropertyOverrideList getItemPropertyOverrides() {
|
||||
return ModelItemPropertyOverrideList.EMPTY;
|
||||
public ModelOverrideList getOverrides() {
|
||||
return ModelOverrideList.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.block.DispenserBlock;
|
|||
import net.minecraft.block.FluidDrainable;
|
||||
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
||||
import net.minecraft.block.entity.DispenserBlockEntity;
|
||||
import net.minecraft.fluid.BaseFluid;
|
||||
import net.minecraft.fluid.FlowableFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -79,7 +79,7 @@ public class TRDispenserBehavior {
|
|||
// fill cell
|
||||
if (block instanceof FluidDrainable) {
|
||||
Fluid fluid = ((FluidDrainable)block).tryDrainFluid(iWorld, blockPos, blockState);
|
||||
if (!(fluid instanceof BaseFluid)) {
|
||||
if (!(fluid instanceof FlowableFluid)) {
|
||||
return super.dispenseSilently(pointer, stack);
|
||||
} else {
|
||||
ItemStack filledCell = DynamicCellItem.getCellWithFluid(fluid, 1);
|
||||
|
|
|
@ -47,12 +47,6 @@ public class BatteryItem extends Item implements EnergyHolder, ItemDurabilityExt
|
|||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamageIfAbsent(1));
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.tier = tier;
|
||||
this.addPropertyGetter(new Identifier("techreborn:empty"), (stack, worldIn, entityIn) -> {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
});
|
||||
}
|
||||
|
||||
// Item
|
||||
|
|
|
@ -29,7 +29,7 @@ import net.minecraft.block.FluidDrainable;
|
|||
import net.minecraft.block.FluidFillable;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.BaseFluid;
|
||||
import net.minecraft.fluid.FlowableFluid;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -126,7 +126,7 @@ public class DynamicCellItem extends Item implements ItemFluidInfo {
|
|||
world.addParticle(ParticleTypes.LARGE_SMOKE, (double)i + Math.random(), (double)j + Math.random(), (double)k + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
} else if (blockState.getBlock() instanceof FluidFillable && fluid == Fluids.WATER) {
|
||||
if (((FluidFillable)blockState.getBlock()).tryFillWithFluid(world, pos, blockState, ((BaseFluid)fluid).getStill(false))) {
|
||||
if (((FluidFillable)blockState.getBlock()).tryFillWithFluid(world, pos, blockState, ((FlowableFluid)fluid).getStill(false))) {
|
||||
this.playEmptyingSound(player, world, pos, fluid);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -55,13 +55,6 @@ public class FrequencyTransmitterItem extends Item {
|
|||
|
||||
public FrequencyTransmitterItem() {
|
||||
super(new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1));
|
||||
this.addPropertyGetter(new Identifier("techreborn", "coords"), (stack, worldIn, entityIn) -> {
|
||||
if (!stack.isEmpty() && stack.hasTag() && stack.getTag() != null && stack.getTag().contains("x")
|
||||
&& stack.getTag().contains("y") && stack.getTag().contains("z") && stack.getTag().contains("dim")) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,6 @@ import net.minecraft.item.ArmorMaterial;
|
|||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.World;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import reborncore.common.util.ItemDurabilityExtensions;
|
||||
|
@ -54,13 +53,6 @@ public class BatpackItem extends ArmorItem implements EnergyHolder, ItemDurabili
|
|||
super(material, EquipmentSlot.CHEST, new Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
this.maxCharge = maxCharge;
|
||||
this.tier = tier;
|
||||
|
||||
this.addPropertyGetter(new Identifier("techreborn:empty"), (stack, worldIn, entityIn) -> {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() == 0) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
});
|
||||
}
|
||||
|
||||
private void distributePowerToInventory(World world, PlayerEntity player, ItemStack itemStack, int maxOutput) {
|
||||
|
|
|
@ -61,14 +61,6 @@ public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilit
|
|||
this.cost = cost;
|
||||
this.poweredSpeed = poweredSpeed;
|
||||
this.referenceTool = referenceTool;
|
||||
|
||||
this.addPropertyGetter(new Identifier("techreborn", "animated"), (stack, worldIn, entityIn) -> {
|
||||
if (!stack.isEmpty() && Energy.of(stack).getEnergy() >= cost
|
||||
&& entityIn != null && entityIn.getMainHandStack().equals(stack)) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
});
|
||||
}
|
||||
|
||||
// AxeItem
|
||||
|
@ -157,4 +149,8 @@ public class ChainsawItem extends AxeItem implements EnergyHolder, ItemDurabilit
|
|||
public double getMaxOutput(EnergySide side) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,15 +65,6 @@ public class NanosaberItem extends SwordItem implements EnergyHolder, ItemDurabi
|
|||
// 4ME max charge with 1k charge rate
|
||||
public NanosaberItem() {
|
||||
super(ToolMaterials.DIAMOND, 1, 1, new Item.Settings().group(TechReborn.ITEMGROUP).maxCount(1).maxDamage(-1));
|
||||
this.addPropertyGetter(new Identifier("techreborn:active"), (stack, worldIn, entityIn) -> {
|
||||
if (ItemUtils.isActive(stack)) {
|
||||
if (Energy.of(stack).getMaxStored() - Energy.of(stack).getEnergy() >= 0.9 * Energy.of(stack).getMaxStored()) {
|
||||
return 0.5F;
|
||||
}
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
});
|
||||
}
|
||||
|
||||
// SwordItem
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
|
||||
package techreborn.world;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.fabricmc.fabric.api.event.registry.RegistryEntryAddedCallback;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.class_5201;
|
||||
import net.minecraft.class_5204;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
@ -42,6 +39,7 @@ import net.minecraft.world.gen.feature.Feature;
|
|||
import net.minecraft.world.gen.feature.OreFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.OreFeatureConfig.Target;
|
||||
import net.minecraft.world.gen.feature.TreeFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.size.TwoLayersFeatureSize;
|
||||
import net.minecraft.world.gen.foliage.BlobFoliagePlacer;
|
||||
import net.minecraft.world.gen.stateprovider.SimpleBlockStateProvider;
|
||||
import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider;
|
||||
|
@ -98,7 +96,7 @@ public class WorldGenerator {
|
|||
new SimpleBlockStateProvider(TRContent.RUBBER_LEAVES.getDefaultState()),
|
||||
new BlobFoliagePlacer(2, 0, 0, 0, 3),
|
||||
new StraightTrunkPlacer(TechRebornConfig.RubberTreeBaseHeight, 3, 0),
|
||||
new class_5204(1, 0, 1)
|
||||
new TwoLayersFeatureSize(1, 0, 1)
|
||||
).build();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue