1.19.4-pre1

This commit is contained in:
modmuss50 2023-02-23 15:51:39 +00:00
parent 32e719115b
commit 759c3fbfc3
58 changed files with 210 additions and 263 deletions

View file

@ -55,7 +55,7 @@ public class RebornCoreClient implements ClientModInitializer {
});
ClientLifecycleEvents.CLIENT_STARTED.register(client -> {
String strangeMcLang = client.getLanguageManager().getLanguage().getCode();
String strangeMcLang = client.getLanguageManager().getLanguage();
RebornCore.locale = Locale.forLanguageTag(strangeMcLang.substring(0, 2));
});
}

View file

@ -79,7 +79,6 @@ public class ClientChunkManager {
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
RenderSystem.lineWidth(5.0F);
@ -100,7 +99,6 @@ public class ClientChunkManager {
tessellator.draw();
RenderSystem.lineWidth(1.0F);
RenderSystem.enableBlend();
RenderSystem.enableTexture();
}
}

View file

@ -79,7 +79,7 @@ public class ItemStackRenderer implements HudRenderCallback {
framebuffer.beginWrite(true);
GlStateManager._clear(GL12.GL_COLOR_BUFFER_BIT | GL12.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC);
MinecraftClient.getInstance().getItemRenderer().renderInGui(item, 0, 0);
MinecraftClient.getInstance().getItemRenderer().renderInGui(stack, item, 0, 0);
framebuffer.endWrite();
framebuffer.beginRead();

View file

@ -146,7 +146,6 @@ public class RenderUtil {
}
public static void drawGradientRect(MatrixStack matrices, int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) {
RenderSystem.disableTexture();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
@ -172,7 +171,6 @@ public class RenderUtil {
tessellator.draw();
RenderSystem.disableBlend();
RenderSystem.enableTexture();
}
}

View file

@ -50,7 +50,7 @@ public class RedstoneConfigGui {
int i = 0;
int spread = configuration.getElements().size() == 3 ? 27 : 18;
for (RedstoneConfiguration.Element element : configuration.getElements()) {
itemRenderer.renderInGuiWithOverrides(element.getIcon(), x - 3, y + (i * spread) - 5);
itemRenderer.renderInGuiWithOverrides(matrixStack, element.getIcon(), x - 3, y + (i * spread) - 5);
guiBase.getTextRenderer().draw(matrixStack, Text.translatable("reborncore.gui.fluidconfig." + element.getName()), x + 15, y + (i * spread), -1);

View file

@ -114,8 +114,8 @@ public class ConfigSlotElement extends ElementBase {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
ItemRenderer renderItem = MinecraftClient.getInstance().getItemRenderer();
renderItem.renderInGuiWithOverrides(stack, xPos, yPos);
renderItem.renderGuiItemOverlay(gui.getTextRenderer(), stack, xPos, yPos, null);
renderItem.renderInGuiWithOverrides(matrixStack, stack, xPos, yPos);
renderItem.renderGuiItemOverlay(matrixStack, gui.getTextRenderer(), stack, xPos, yPos, null);
RenderSystem.disableDepthTest();
matrixStack.pop();
if (isHovering) {

View file

@ -318,7 +318,7 @@ public class ElementBase {
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
ItemRenderer itemRenderer = MinecraftClient.getInstance().getItemRenderer();
itemRenderer.renderInGuiWithOverrides(sprite.itemStack, x + gui.getGuiLeft(), y + gui.getGuiTop());
itemRenderer.renderInGuiWithOverrides(matrixStack, sprite.itemStack, x + gui.getGuiLeft(), y + gui.getGuiTop());
matrixStack.pop();
}

View file

@ -387,7 +387,7 @@ public class GuiBuilder {
public void drawSlotTab(MatrixStack matrixStack, GuiBase<?> gui, int x, int y, ItemStack stack) {
RenderSystem.setShaderTexture(0, resourceLocation);
gui.drawTexture(matrixStack, x, y, 217, 82, 24, 24);
gui.getMinecraft().getItemRenderer().renderInGuiWithOverrides(stack, x + 5, y + 4);
gui.getMinecraft().getItemRenderer().renderInGuiWithOverrides(matrixStack, stack, x + 5, y + 4);
}
@ -461,7 +461,7 @@ public class GuiBuilder {
@Override
public void render(MatrixStack matrixStack, int index, int y, int x, int width, int height, int mouseX, int mouseY, boolean hovering, float delta) {
MinecraftClient.getInstance().textRenderer.drawTrimmed(tip, x, y, width, 11184810);
MinecraftClient.getInstance().textRenderer.drawTrimmed(matrixStack, tip, x, y, width, 11184810);
}
}
}

View file

@ -33,6 +33,7 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.BlockRenderManager;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.ItemStack;
@ -40,6 +41,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import reborncore.common.blockentity.MultiblockWriter;
import java.util.function.BiPredicate;
@ -48,7 +50,7 @@ import java.util.function.BiPredicate;
* Renders a hologram
*/
public
record HologramRenderer(BlockRenderView view, MatrixStack matrix, VertexConsumerProvider vertexConsumerProvider,
record HologramRenderer(World view, MatrixStack matrix, VertexConsumerProvider vertexConsumerProvider,
float scale) implements MultiblockWriter {
private static final BlockPos OUT_OF_WORLD_POS = new BlockPos(0, 260, 0); // Bad hack; disables lighting
@ -63,7 +65,7 @@ record HologramRenderer(BlockRenderView view, MatrixStack matrix, VertexConsumer
if (state.getBlock() instanceof FluidBlock) {
FluidState fluidState = ((FluidBlock) state.getBlock()).getFluidState(state);
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(fluidState.getFluid().getBucketItem()), ModelTransformation.Mode.FIXED, 15728880, OverlayTexture.DEFAULT_UV, matrix, vertexConsumerProvider, 0);
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(fluidState.getFluid().getBucketItem()), ModelTransformationMode.FIXED, 15728880, OverlayTexture.DEFAULT_UV, matrix, vertexConsumerProvider, view, 0);
} else {
matrix.translate(-0.5, -0.5, -0.5);
VertexConsumer consumer = vertexConsumerProvider.getBuffer(RenderLayers.getBlockLayer(state));

View file

@ -32,10 +32,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.common.crafting.ingredient.RebornIngredient;
@ -103,7 +105,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
return ingredients;
}
public List<ItemStack> getOutputs() {
public List<ItemStack> getOutputs(@Nullable DynamicRegistryManager registryManager) {
return Collections.unmodifiableList(outputs);
}
@ -142,9 +144,8 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
throw new UnsupportedOperationException();
}
@Deprecated
@Override
public ItemStack craft(Inventory inv) {
public ItemStack craft(Inventory inventory, @Nullable DynamicRegistryManager dynamicRegistryManager) {
throw new UnsupportedOperationException();
}
@ -156,11 +157,11 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
/**
* Do not call directly, this is implemented only as a fallback.
* {@link RebornRecipe#getOutputs()} will return all the outputs
* {@link RebornRecipe#getOutputs(DynamicRegistryManager)} will return all the outputs
*/
@Deprecated
@Override
public ItemStack getOutput() {
public ItemStack getOutput(DynamicRegistryManager dynamicRegistryManager) {
if (outputs.isEmpty()) {
return ItemStack.EMPTY;
}

View file

@ -70,7 +70,7 @@ public abstract class AbstractRecipeSerde<R extends RebornRecipe> implements Rec
protected void writeOutputs(R recipe, JsonObject jsonObject) {
final JsonArray resultsArray = new JsonArray();
for (ItemStack stack : recipe.getOutputs()) {
for (ItemStack stack : recipe.getOutputs(null)) {
final JsonObject stackObject = new JsonObject();
stackObject.addProperty("item", Registries.ITEM.getId(stack.getItem()).toString());

View file

@ -1,37 +0,0 @@
/*
* This file is part of RebornCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 TeamReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package reborncore.common.explosion;
import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.EntityDamageSource;
/**
* Created by modmuss50 on 16/03/2016.
*/
public class NuclearDamageSource extends EntityDamageSource {
public NuclearDamageSource(Entity entity) {
super("nuke", entity);
}
}

View file

@ -30,7 +30,7 @@ import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;

View file

@ -67,7 +67,7 @@ public class PaddedShapedRecipeJsonBuilder extends ShapedRecipeJsonBuilder {
static class PaddedShapedRecipeJsonProvider extends PaddedShapedRecipeJsonBuilder.ShapedRecipeJsonProvider {
public PaddedShapedRecipeJsonProvider(Identifier recipeId, Item output, int resultCount, String group, CraftingRecipeCategory category, List<String> pattern, Map<Character, Ingredient> inputs, Advancement.Builder advancementBuilder, Identifier advancementId) {
super(recipeId, output, resultCount, group, category, pattern, inputs, advancementBuilder, advancementId);
super(recipeId, output, resultCount, group, category, pattern, inputs, advancementBuilder, advancementId, false);
}
@Override

View file

@ -28,6 +28,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.util.math.BlockPos;
import org.jetbrains.annotations.Nullable;
import reborncore.RebornCore;
@ -41,6 +42,7 @@ import reborncore.common.util.ItemUtils;
import reborncore.common.util.RebornInventory;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
/**
@ -154,21 +156,23 @@ public class RecipeCrafter implements IUpgradeHandler {
}
// If it has reached the recipe tick time
if (currentRecipe != null && currentTickTime >= currentNeededTicks && hasAllInputs()) {
final List<ItemStack> outputs = currentRecipe.getOutputs(getDynamicRegistryManager());
boolean canGiveInvAll = true;
// Checks to see if it can fit the output
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {
if (!canFitOutput(currentRecipe.getOutputs().get(i), outputSlots[i])) {
for (int i = 0; i < outputs.size(); i++) {
if (!canFitOutput(outputs.get(i), outputSlots[i])) {
canGiveInvAll = false;
}
}
// The slots that have been filled
ArrayList<Integer> filledSlots = new ArrayList<>();
if (canGiveInvAll && currentRecipe.onCraft(blockEntity)) {
for (int i = 0; i < currentRecipe.getOutputs().size(); i++) {
for (int i = 0; i < outputs.size(); i++) {
// Checks it has not been filled
if (!filledSlots.contains(outputSlots[i])) {
// Fills the slot with the output stack
fitStack(currentRecipe.getOutputs().get(i).copy(), outputSlots[i]);
fitStack(outputs.get(i).copy(), outputSlots[i]);
filledSlots.add(outputSlots[i]);
}
}
@ -207,10 +211,12 @@ public class RecipeCrafter implements IUpgradeHandler {
if (!hasAllInputs(recipe)) continue;
if (!recipe.canCraft(blockEntity)) continue;
final List<ItemStack> outputs = recipe.getOutputs(getDynamicRegistryManager());
// This checks to see if it can fit all the outputs
boolean hasOutputSpace = true;
for (int i = 0; i < recipe.getOutputs().size(); i++) {
if (!canFitOutput(recipe.getOutputs().get(i), outputSlots[i])) {
for (int i = 0; i < outputs.size(); i++) {
if (!canFitOutput(outputs.get(i), outputSlots[i])) {
hasOutputSpace = false;
}
}
@ -323,8 +329,10 @@ public class RecipeCrafter implements IUpgradeHandler {
public boolean canCraftAgain() {
for (RebornRecipe recipe : recipeType.getRecipes(blockEntity.getWorld())) {
if (recipe.canCraft(blockEntity) && hasAllInputs(recipe)) {
for (int i = 0; i < recipe.getOutputs().size(); i++) {
if (!canFitOutput(recipe.getOutputs().get(i), outputSlots[i])) {
final List<ItemStack> outputs = recipe.getOutputs(getDynamicRegistryManager());
for (int i = 0; i < outputs.size(); i++) {
if (!canFitOutput(outputs.get(i), outputSlots[i])) {
return false;
}
}
@ -431,4 +439,9 @@ public class RecipeCrafter implements IUpgradeHandler {
public boolean isMuffled() {
return parentUpgradeHandler.map(IUpgradeHandler::isMuffled).orElse(false);
}
@Nullable
private DynamicRegistryManager getDynamicRegistryManager() {
return blockEntity.getWorld().getRegistryManager();
}
}

View file

@ -28,11 +28,11 @@
}
],
"depends": {
"fabricloader": ">=0.14.11",
"fabric-api": ">=0.68.1",
"fabricloader": ">=0.14.15",
"fabric-api": ">=0.75.0",
"team_reborn_energy": ">=2.3.0",
"fabric-biome-api-v1": ">=3.0.0",
"minecraft": ">=1.19.3- <1.19.4-"
"minecraft": ">=1.19.4- <1.19.5-"
},
"authors": [
"Team Reborn",

View file

@ -194,7 +194,7 @@ dependencies {
include project(":RebornCore")
optionalClientDependency("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}", true)
optionalClientDependency("me.shedaniel:RoughlyEnoughItems-fabric:${project.rei_version}", false)
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
gametestImplementation 'org.apache.groovy:groovy:4.0.6'

View file

@ -7,10 +7,10 @@ mod_version=5.5.0
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.19.3
yarn_version=1.19.3+build.1
loader_version=0.14.11
fapi_version=0.69.1+1.19.3
minecraft_version=1.19.4-pre1
yarn_version=1.19.4-pre1+build.1
loader_version=0.14.15
fapi_version=0.75.0+1.19.4
# Dependencies
energy_version=2.3.0

Binary file not shown.

View file

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -52,7 +52,7 @@ public class MachineRecipeDisplay<R extends RebornRecipe> implements Display {
public MachineRecipeDisplay(R recipe) {
this.recipe = recipe;
this.inputs = CollectionUtils.map(recipe.getRebornIngredients(), ing -> EntryIngredients.ofItemStacks(ing.getPreviewStacks()));
this.outputs = recipe.getOutputs().stream().map(EntryIngredients::of).collect(Collectors.toList());
this.outputs = recipe.getOutputs(null).stream().map(EntryIngredients::of).collect(Collectors.toList());
this.time = recipe.getTime();
this.energy = recipe.getPower();
if (recipe instanceof BlastFurnaceRecipe) {

View file

@ -51,8 +51,8 @@ public class GuiAutoCrafting extends GuiBase<BuiltScreenHandler> {
this.blockEntityAutoCraftingTable = blockEntity;
}
public void renderItemStack(ItemStack stack, int x, int y) {
MinecraftClient.getInstance().getItemRenderer().renderInGuiWithOverrides(stack, x, y);
public void renderItemStack(MatrixStack matrixStack, ItemStack stack, int x, int y) {
MinecraftClient.getInstance().getItemRenderer().renderInGuiWithOverrides(matrixStack, stack, x, y);
}
@Override
@ -79,7 +79,7 @@ public class GuiAutoCrafting extends GuiBase<BuiltScreenHandler> {
CraftingRecipe recipe = blockEntityAutoCraftingTable.getCurrentRecipe();
if (recipe != null) {
renderItemStack(recipe.getOutput(), 95 + getGuiLeft(), 42 + getGuiTop());
renderItemStack(matrixStack, recipe.getOutput(getMachine().getWorld().getRegistryManager()), 95 + getGuiLeft(), 42 + getGuiTop());
}
builder.drawLockButton(matrixStack, this, 145, 4, mouseX, mouseY, layer, blockEntityAutoCraftingTable.locked);

View file

@ -32,6 +32,7 @@ import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Direction;
@ -67,7 +68,7 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
case EAST -> matrices.translate(-1, 1, 2);
}
int lightAbove = WorldRenderer.getLightmapCoordinates(storage.getWorld(), storage.getPos().offset(storage.getFacing()));
MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformation.Mode.FIXED, lightAbove, OverlayTexture.DEFAULT_UV, matrices, vertexConsumers, 0);
MinecraftClient.getInstance().getItemRenderer().renderItem(stack, ModelTransformationMode.FIXED, lightAbove, OverlayTexture.DEFAULT_UV, matrices, vertexConsumers, storage.getWorld(), 0);
matrices.pop();
// Text rendering
@ -89,12 +90,12 @@ public class StorageUnitRenderer implements BlockEntityRenderer<StorageUnitBaseB
// Render item count
String count = String.valueOf(storage.storedAmount);
xPosition = (float) (-textRenderer.getWidth(count) / 2);
textRenderer.draw(count, xPosition, -4f + 40, 0, false, matrices.peek().getPositionMatrix(), vertexConsumers, false, 0, light);
textRenderer.draw(count, xPosition, -4f + 40, 0, false, matrices.peek().getPositionMatrix(), vertexConsumers, TextRenderer.TextLayerType.NORMAL, 0, light);
// Render name
String item = stack.getName().asTruncatedString(18);
xPosition = (float) (-textRenderer.getWidth(item) / 2);
textRenderer.draw(item, xPosition, -4f - 40, 0, false, matrices.peek().getPositionMatrix(), vertexConsumers, false, 0, light);
textRenderer.draw(item, xPosition, -4f - 40, 0, false, matrices.peek().getPositionMatrix(), vertexConsumers, TextRenderer.TextLayerType.NORMAL, 0, light);
matrices.pop();
}

View file

@ -26,6 +26,7 @@ package techreborn.client.render.entitys;
import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.model.ModelPartBuilder;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider;
@ -40,9 +41,12 @@ import techreborn.blockentity.generator.basic.WindMillBlockEntity;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Set;
public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity> {
private static final Set<Direction> ALL_DIRECTIONS = EnumSet.allOf(Direction.class);
private static final TurbineModel MODEL = new TurbineModel();
public static final Identifier TEXTURE = new Identifier("techreborn:textures/block/machines/generators/wind_mill_turbine.png");
@ -76,14 +80,14 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
super(RenderLayer::getEntityCutoutNoCull);
ModelPart.Cuboid[] baseCuboids = {
new ModelPart.Cuboid(0, 0, -2.0F, -2.0F, -1.0F, 4F, 4F, 2F, 0F, 0F, 0F, false, 64F, 64F),
new ModelPart.Cuboid(0, 6, -1.0F, -1.0F, -2.0F, 2F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
new ModelPart.Cuboid(0, 0, -2.0F, -2.0F, -1.0F, 4F, 4F, 2F, 0F, 0F, 0F, false, 64F, 64F, ALL_DIRECTIONS),
new ModelPart.Cuboid(0, 6, -1.0F, -1.0F, -2.0F, 2F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F, ALL_DIRECTIONS)
};
base = new ModelPart(Arrays.asList(baseCuboids), new HashMap<>() {
{
ModelPart.Cuboid[] blade1Cuboids = {
new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F, ALL_DIRECTIONS)
};
ModelPart blade1 = new ModelPart(Arrays.asList(blade1Cuboids), Collections.emptyMap());
blade1.setPivot(0.0F, 0.0F, 0.0F);
@ -91,7 +95,7 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
put("blade1", blade1);
ModelPart.Cuboid[] blade2Cuboids = {
new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
new ModelPart.Cuboid(0, 9, -24.0F, -1.0F, -0.5F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F, ALL_DIRECTIONS)
};
ModelPart blade2 = new ModelPart(Arrays.asList(blade2Cuboids), Collections.emptyMap());
blade2.setPivot(0.0F, 0.0F, 0.0F);
@ -99,7 +103,7 @@ public class TurbineRenderer implements BlockEntityRenderer<WindMillBlockEntity>
put("blade2", blade2);
ModelPart.Cuboid[] blade3Cuboids = {
new ModelPart.Cuboid(0, 9, -24.0F, -2.0F, -1.075F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F)
new ModelPart.Cuboid(0, 9, -24.0F, -2.0F, -1.075F, 24F, 2F, 1F, 0F, 0F, 0F, false, 64F, 64F, ALL_DIRECTIONS)
};
ModelPart blade3 = new ModelPart(Arrays.asList(blade3Cuboids), Collections.emptyMap());
blade3.setPivot(0.0F, 0.0F, 0.0F);

View file

@ -31,7 +31,6 @@ import net.minecraft.registry.RegistryKeys
import techreborn.TechReborn
import techreborn.datagen.models.BlockLootTableProvider
import techreborn.datagen.models.ModelProvider
import techreborn.datagen.recipes.Json2Datagen
import techreborn.datagen.recipes.crafting.CraftingRecipesProvider
import techreborn.datagen.recipes.machine.alloy_smelter.AlloySmelterRecipesProvider
import techreborn.datagen.recipes.machine.assembling_machine.AssemblingMachineRecipesProvider
@ -46,8 +45,8 @@ import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
import techreborn.datagen.tags.TRBlockTagProvider
import techreborn.datagen.tags.TRItemTagProvider
import techreborn.datagen.tags.TRPointOfInterestTagProvider
import techreborn.datagen.worldgen.TRWorldGenBootstrap
import techreborn.datagen.worldgen.TRWorldGenProvider
import techreborn.datagen.dynamic.TRDynamicContent
import techreborn.datagen.dynamic.TRDynamicProvider
class TechRebornDataGen implements DataGeneratorEntrypoint {
@ -85,7 +84,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
add ModelProvider::new
add BlockLootTableProvider::new
add TRWorldGenProvider::new
add TRDynamicProvider::new
}
@Override
@ -95,7 +94,8 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
@Override
void buildRegistry(RegistryBuilder registryBuilder) {
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, TRWorldGenBootstrap::configuredFeatures)
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, TRWorldGenBootstrap::placedFeatures)
registryBuilder.addRegistry(RegistryKeys.DAMAGE_TYPE, TRDynamicContent::damageTypes)
registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, TRDynamicContent::configuredFeatures)
registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, TRDynamicContent::placedFeatures)
}
}

View file

@ -22,10 +22,12 @@
* SOFTWARE.
*/
package techreborn.datagen.worldgen
package techreborn.datagen.dynamic
import net.minecraft.block.BlockState
import net.minecraft.block.Blocks
import net.minecraft.entity.damage.DamageEffects
import net.minecraft.entity.damage.DamageType
import net.minecraft.registry.Registerable
import net.minecraft.registry.RegistryEntryLookup
import net.minecraft.registry.RegistryKeys
@ -52,12 +54,18 @@ import net.minecraft.world.gen.trunk.StraightTrunkPlacer
import techreborn.blocks.misc.BlockRubberLog
import techreborn.init.ModFluids
import techreborn.init.TRContent
import techreborn.init.TRDamageTypes
import techreborn.world.RubberTreeSpikeDecorator
import techreborn.world.TROreFeatureConfig
import techreborn.world.TargetDimension
import techreborn.world.WorldGenerator
class TRWorldGenBootstrap {
class TRDynamicContent {
static void damageTypes(Registerable<DamageType> registry) {
registry.register(TRDamageTypes.ELECTRIC_SHOCK, new DamageType("electric_shock", 0.1F, DamageEffects.BURNING))
registry.register(TRDamageTypes.FUSION, new DamageType("fusion", 0.1F, DamageEffects.BURNING))
}
static void configuredFeatures(Registerable<ConfiguredFeature> registry) {
def placedFeatureLookup = registry.getRegistryLookup(RegistryKeys.PLACED_FEATURE)

View file

@ -22,7 +22,7 @@
* SOFTWARE.
*/
package techreborn.datagen.worldgen
package techreborn.datagen.dynamic
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput
import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider
@ -31,8 +31,8 @@ import net.minecraft.registry.RegistryWrapper
import java.util.concurrent.CompletableFuture
class TRWorldGenProvider extends FabricDynamicRegistryProvider {
TRWorldGenProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
class TRDynamicProvider extends FabricDynamicRegistryProvider {
TRDynamicProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture)
}
@ -40,6 +40,7 @@ class TRWorldGenProvider extends FabricDynamicRegistryProvider {
protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) {
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.CONFIGURED_FEATURE))
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE))
entries.addAll(registries.getWrapperOrThrow(RegistryKeys.DAMAGE_TYPE))
}
@Override

View file

@ -30,6 +30,7 @@ import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.ShapedRecipe;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.world.World;
@ -56,13 +57,13 @@ public class RollingMachineRecipe extends RebornRecipe {
}
@Override
public List<ItemStack> getOutputs() {
return Collections.singletonList(shapedRecipe.getOutput());
public List<ItemStack> getOutputs(DynamicRegistryManager registryManager) {
return Collections.singletonList(shapedRecipe.getOutput(registryManager));
}
@Override
public ItemStack getOutput() {
return shapedRecipe.getOutput();
public ItemStack getOutput(DynamicRegistryManager registryManager) {
return shapedRecipe.getOutput(registryManager);
}
@Override
@ -76,8 +77,8 @@ public class RollingMachineRecipe extends RebornRecipe {
}
@Override
public ItemStack craft(Inventory inv) {
return shapedRecipe.craft((CraftingInventory) inv);
public ItemStack craft(Inventory inv, DynamicRegistryManager registryManager) {
return shapedRecipe.craft((CraftingInventory) inv, registryManager);
}
@Override

View file

@ -88,7 +88,7 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
ItemStack itemstack = null;
for (RebornRecipe recipeType : ModRecipes.ALLOY_SMELTER.getRecipes(world)) {
if (hasAllInputs(recipeType)) {
List<ItemStack> outputs = recipeType.getOutputs();
List<ItemStack> outputs = recipeType.getOutputs(getWorld().getRegistryManager());
if(outputs.isEmpty()){
continue;
@ -121,7 +121,7 @@ public class IronAlloyFurnaceBlockEntity extends AbstractIronMachineBlockEntity
return;
}
ItemStack outputStack = currentRecipe.getOutputs().get(0);
ItemStack outputStack = currentRecipe.getOutputs(getWorld().getRegistryManager()).get(0);
if (outputStack.isEmpty()) {
return;
}

View file

@ -105,7 +105,7 @@ public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity imple
Recipe<?> matchingRecipe = refreshRecipe(stack);
if (matchingRecipe != null) {
return matchingRecipe.getOutput().copy();
return matchingRecipe.getOutput(getWorld().getRegistryManager()).copy();
}
return ItemStack.EMPTY;

View file

@ -168,7 +168,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
* @return {@code boolean} True if we have all inputs and can fit output
*/
private boolean validateRecipe(FusionReactorRecipe recipe) {
return hasAllInputs(recipe) && canFitStack(recipe.getOutputs().get(0), outputStackSlot, true);
return hasAllInputs(recipe) && canFitStack(recipe.getOutputs(getWorld().getRegistryManager()).get(0), outputStackSlot, true);
}
/**
@ -319,7 +319,7 @@ public class FusionControlComputerBlockEntity extends GenericMachineBlockEntity
}
}
} else if (craftingTickTime >= currentRecipe.getTime()) {
ItemStack result = currentRecipe.getOutputs().get(0);
ItemStack result = currentRecipe.getOutputs(getWorld().getRegistryManager()).get(0);
if (canFitStack(result, outputStackSlot, true)) {
if (inventory.getStack(outputStackSlot).isEmpty()) {
inventory.setStack(outputStackSlot, result.copy());

View file

@ -160,7 +160,7 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
if (!recipe.matches(crafting, world)) return false;
if (!hasOutputSpace(recipe.getOutput(), OUTPUT_SLOT)) return false;
if (!hasOutputSpace(recipe.getOutput(getWorld().getRegistryManager()), OUTPUT_SLOT)) return false;
DefaultedList<ItemStack> remainingStacks = recipe.getRemainder(crafting);
for (ItemStack stack : remainingStacks) {
@ -225,11 +225,11 @@ public class AutoCraftingTableBlockEntity extends PowerAcceptorBlockEntity
}
}
ItemStack output = inventory.getStack(OUTPUT_SLOT);
ItemStack outputStack = recipe.craft(getCraftingInventory());
ItemStack outputStack = recipe.craft(getCraftingInventory(), getWorld().getRegistryManager());
if (output.isEmpty()) {
inventory.setStack(OUTPUT_SLOT, outputStack.copy());
} else {
output.increment(recipe.getOutput().getCount());
output.increment(recipe.getOutput(getWorld().getRegistryManager()).getCount());
}
return true;
}

View file

@ -96,7 +96,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
}
private boolean canAcceptOutput(SmeltingRecipe recipe, int slot) {
ItemStack recipeOutput = recipe.getOutput();
ItemStack recipeOutput = recipe.getOutput(getWorld().getRegistryManager());
if (recipeOutput.isEmpty()) {
return false;
}
@ -159,7 +159,7 @@ public class ElectricFurnaceBlockEntity extends PowerAcceptorBlockEntity
}
ItemStack outputStack = inventory.getStack(outputSlot);
if (outputStack.isEmpty()) {
inventory.setStack(outputSlot, recipe.getOutput().copy());
inventory.setStack(outputSlot, recipe.getOutput(getWorld().getRegistryManager()).copy());
} else {
// Just increment. We already checked stack match and stack size
outputStack.increment(1);

View file

@ -121,7 +121,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
craftMatrix = balanceResult.get();
}
}
currentRecipeOutput = currentRecipe.craft(craftMatrix);
currentRecipeOutput = currentRecipe.craft(craftMatrix, getWorld().getRegistryManager());
} else {
currentRecipeOutput = ItemStack.EMPTY;
}
@ -329,7 +329,7 @@ public class RollingMachineBlockEntity extends PowerAcceptorBlockEntity
if (recipe == null) {
return ItemStack.EMPTY;
}
return recipe.getOutput();
return recipe.getOutput(getWorld().getRegistryManager());
}
public RollingMachineRecipe findMatchingRecipe(CraftingInventory inv, World world) {

View file

@ -31,6 +31,7 @@ import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
@ -38,6 +39,7 @@ import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
@ -65,7 +67,7 @@ import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.config.TechRebornConfig;
import techreborn.init.ModSounds;
import techreborn.init.TRContent;
import techreborn.utils.damageSources.ElectricalShockSource;
import techreborn.init.TRDamageTypes;
import java.util.HashMap;
import java.util.Map;
@ -240,7 +242,8 @@ public class CableBlock extends BlockWithEntity implements Waterloggable {
if (type == TRContent.Cables.HV) {
entity.setOnFireFor(1);
}
entity.damage(new ElectricalShockSource(), 1F);
entity.damage(TRDamageTypes.create(world, TRDamageTypes.ELECTRIC_SHOCK), 1F);
blockEntityCable.setEnergy(0);
}
if (TechRebornConfig.uninsulatedElectrocutionSound) {

View file

@ -27,9 +27,12 @@ package techreborn.blocks.generator;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@ -41,7 +44,7 @@ import reborncore.common.util.Torus;
import techreborn.blockentity.GuiType;
import techreborn.blockentity.machine.multiblock.FusionControlComputerBlockEntity;
import techreborn.init.TRContent;
import techreborn.utils.damageSources.FusionDamageSource;
import techreborn.init.TRDamageTypes;
import java.util.List;
@ -87,7 +90,7 @@ public class BlockFusionControlComputer extends BlockMachineBase {
if (worldIn.getBlockEntity(pos) instanceof FusionControlComputerBlockEntity) {
if (((FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos)).craftingTickTime != 0
&& ((FusionControlComputerBlockEntity) worldIn.getBlockEntity(pos)).isMultiblockValid()) {
entityIn.damage(new FusionDamageSource(), 200F);
entityIn.damage(TRDamageTypes.create(worldIn, TRDamageTypes.FUSION), 200F);
}
}
}

View file

@ -26,6 +26,7 @@ package techreborn.blocks.misc;
import net.minecraft.block.ButtonBlock;
import net.minecraft.sound.SoundEvents;
import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
/**
@ -34,6 +35,6 @@ import techreborn.utils.InitUtils;
public class RubberButtonBlock extends ButtonBlock {
public RubberButtonBlock() {
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), 30, true, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_ON);
super(InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), TRContent.RUBBER_WOOD_SET_TYPE, 30, true);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.blocks.misc;
import net.minecraft.block.DoorBlock;
import net.minecraft.sound.SoundEvents;
import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
/**
@ -34,6 +35,6 @@ import techreborn.utils.InitUtils;
public class RubberDoorBlock extends DoorBlock {
public RubberDoorBlock() {
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_CLOSE, SoundEvents.BLOCK_NETHER_WOOD_TRAPDOOR_OPEN);
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), TRContent.RUBBER_WOOD_SET_TYPE);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.blocks.misc;
import net.minecraft.block.PressurePlateBlock;
import net.minecraft.sound.SoundEvents;
import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
/**
@ -34,7 +35,7 @@ import techreborn.utils.InitUtils;
public class RubberPressurePlateBlock extends PressurePlateBlock {
public RubberPressurePlateBlock() {
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_NETHER_WOOD_PRESSURE_PLATE_CLICK_ON);
super(PressurePlateBlock.ActivationRule.EVERYTHING, InitUtils.setupRubberBlockSettings(true, 0.5F, 0.5F), TRContent.RUBBER_WOOD_SET_TYPE);
}
}

View file

@ -26,6 +26,7 @@ package techreborn.blocks.misc;
import net.minecraft.block.TrapdoorBlock;
import net.minecraft.sound.SoundEvents;
import techreborn.init.TRContent;
import techreborn.utils.InitUtils;
/**
@ -34,6 +35,6 @@ import techreborn.utils.InitUtils;
public class RubberTrapdoorBlock extends TrapdoorBlock {
public RubberTrapdoorBlock() {
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN);
super(InitUtils.setupRubberBlockSettings(3.0F, 3.0F), TRContent.RUBBER_WOOD_SET_TYPE);
}
}

View file

@ -79,7 +79,7 @@ public class EntityNukePrimed extends TntEntity {
return;
}
RebornExplosion nukeExplosion = new RebornExplosion(getBlockPos(), world, TechRebornConfig.nukeRadius);
nukeExplosion.setLivingBase(getCausingEntity());
nukeExplosion.setLivingBase(getOwner());
nukeExplosion.applyExplosion();
}
}

View file

@ -28,6 +28,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage;
import net.minecraft.block.*;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings;
import net.minecraft.item.Items;
@ -105,7 +106,7 @@ public class ModRegistry {
RebornRegistry.registerBlock(TRContent.RUBBER_SAPLING = InitUtils.setup(new BlockRubberSapling(), "rubber_sapling"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_SLAB = InitUtils.setup(new SlabBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_slab"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE = InitUtils.setup(new FenceBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F)), "rubber_fence"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN), "rubber_fence_gate"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_FENCE_GATE = InitUtils.setup(new FenceGateBlock(InitUtils.setupRubberBlockSettings(2.0F, 15.0F), TRContent.RUBBER_WOOD_TYPE), "rubber_fence_gate"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_STAIR = InitUtils.setup(new BlockRubberPlankStair(), "rubber_stair"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_TRAPDOOR = InitUtils.setup(new RubberTrapdoorBlock(), "rubber_trapdoor"), itemGroup);
RebornRegistry.registerBlock(TRContent.RUBBER_BUTTON = InitUtils.setup(new RubberButtonBlock(), "rubber_button"), itemGroup);
@ -128,10 +129,10 @@ public class ModRegistry {
Arrays.stream(Parts.values()).forEach(value -> RebornRegistry.registerItem(value.asItem()));
Arrays.stream(Upgrades.values()).forEach(value -> RebornRegistry.registerItem(value.asItem()));
RebornRegistry.registerItem(TRContent.QUANTUM_HELMET = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, EquipmentSlot.HEAD), "quantum_helmet"));
RebornRegistry.registerItem(TRContent.QUANTUM_CHESTPLATE = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, EquipmentSlot.CHEST), "quantum_chestplate"));
RebornRegistry.registerItem(TRContent.QUANTUM_LEGGINGS = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, EquipmentSlot.LEGS), "quantum_leggings"));
RebornRegistry.registerItem(TRContent.QUANTUM_BOOTS = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, EquipmentSlot.FEET), "quantum_boots"));
RebornRegistry.registerItem(TRContent.QUANTUM_HELMET = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, ArmorItem.Type.HELMET), "quantum_helmet"));
RebornRegistry.registerItem(TRContent.QUANTUM_CHESTPLATE = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, ArmorItem.Type.CHESTPLATE), "quantum_chestplate"));
RebornRegistry.registerItem(TRContent.QUANTUM_LEGGINGS = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, ArmorItem.Type.LEGGINGS), "quantum_leggings"));
RebornRegistry.registerItem(TRContent.QUANTUM_BOOTS = InitUtils.setup(new QuantumSuitItem(TRArmorMaterials.QUANTUM, ArmorItem.Type.BOOTS), "quantum_boots"));
// Gem armor & tools
// Todo: repair with tags
@ -141,10 +142,10 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.BRONZE_AXE = InitUtils.setup(new TRAxeItem(TRToolTier.BRONZE), "bronze_axe"));
RebornRegistry.registerItem(TRContent.BRONZE_HOE = InitUtils.setup(new TRHoeItem(TRToolTier.BRONZE), "bronze_hoe"));
RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, EquipmentSlot.HEAD), "bronze_helmet"));
RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, EquipmentSlot.CHEST), "bronze_chestplate"));
RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, EquipmentSlot.LEGS), "bronze_leggings"));
RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, EquipmentSlot.FEET), "bronze_boots"));
RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, ArmorItem.Type.HELMET), "bronze_helmet"));
RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, ArmorItem.Type.CHESTPLATE), "bronze_chestplate"));
RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, ArmorItem.Type.LEGGINGS), "bronze_leggings"));
RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.BRONZE, ArmorItem.Type.BOOTS), "bronze_boots"));
RebornRegistry.registerItem(TRContent.RUBY_SWORD = InitUtils.setup(new TRSwordItem(TRToolTier.RUBY), "ruby_sword"));
RebornRegistry.registerItem(TRContent.RUBY_PICKAXE = InitUtils.setup(new TRPickaxeItem(TRToolTier.RUBY), "ruby_pickaxe"));
@ -152,10 +153,10 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.RUBY_AXE = InitUtils.setup(new TRAxeItem(TRToolTier.RUBY), "ruby_axe"));
RebornRegistry.registerItem(TRContent.RUBY_HOE = InitUtils.setup(new TRHoeItem(TRToolTier.RUBY), "ruby_hoe"));
RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, EquipmentSlot.HEAD), "ruby_helmet"));
RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, EquipmentSlot.CHEST), "ruby_chestplate"));
RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, EquipmentSlot.LEGS), "ruby_leggings"));
RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, EquipmentSlot.FEET), "ruby_boots"));
RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, ArmorItem.Type.HELMET), "ruby_helmet"));
RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, ArmorItem.Type.CHESTPLATE), "ruby_chestplate"));
RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, ArmorItem.Type.LEGGINGS), "ruby_leggings"));
RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.RUBY, ArmorItem.Type.BOOTS), "ruby_boots"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_SWORD = InitUtils.setup(new TRSwordItem(TRToolTier.SAPPHIRE), "sapphire_sword"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_PICKAXE = InitUtils.setup(new TRPickaxeItem(TRToolTier.SAPPHIRE), "sapphire_pickaxe"));
@ -163,10 +164,10 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.SAPPHIRE_AXE = InitUtils.setup(new TRAxeItem(TRToolTier.SAPPHIRE), "sapphire_axe"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_HOE = InitUtils.setup(new TRHoeItem(TRToolTier.SAPPHIRE), "sapphire_hoe"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, EquipmentSlot.HEAD), "sapphire_helmet"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, EquipmentSlot.CHEST), "sapphire_chestplate"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, EquipmentSlot.LEGS), "sapphire_leggings"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, EquipmentSlot.FEET), "sapphire_boots"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, ArmorItem.Type.HELMET), "sapphire_helmet"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, ArmorItem.Type.CHESTPLATE), "sapphire_chestplate"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, ArmorItem.Type.LEGGINGS), "sapphire_leggings"));
RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SAPPHIRE, ArmorItem.Type.BOOTS), "sapphire_boots"));
RebornRegistry.registerItem(TRContent.PERIDOT_SWORD = InitUtils.setup(new TRSwordItem(TRToolTier.PERIDOT), "peridot_sword"));
RebornRegistry.registerItem(TRContent.PERIDOT_PICKAXE = InitUtils.setup(new TRPickaxeItem(TRToolTier.PERIDOT), "peridot_pickaxe"));
@ -174,20 +175,20 @@ public class ModRegistry {
RebornRegistry.registerItem(TRContent.PERIDOT_AXE = InitUtils.setup(new TRAxeItem(TRToolTier.PERIDOT), "peridot_axe"));
RebornRegistry.registerItem(TRContent.PERIDOT_HOE = InitUtils.setup(new TRHoeItem(TRToolTier.PERIDOT), "peridot_hoe"));
RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, EquipmentSlot.HEAD), "peridot_helmet"));
RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, EquipmentSlot.CHEST), "peridot_chestplate"));
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, EquipmentSlot.LEGS), "peridot_leggings"));
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, EquipmentSlot.FEET), "peridot_boots"));
RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, ArmorItem.Type.HELMET), "peridot_helmet"));
RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, ArmorItem.Type.CHESTPLATE), "peridot_chestplate"));
RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, ArmorItem.Type.LEGGINGS), "peridot_leggings"));
RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.PERIDOT, ArmorItem.Type.BOOTS), "peridot_boots"));
RebornRegistry.registerItem(TRContent.SILVER_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.HEAD), "silver_helmet"));
RebornRegistry.registerItem(TRContent.SILVER_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.CHEST), "silver_chestplate"));
RebornRegistry.registerItem(TRContent.SILVER_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.LEGS), "silver_leggings"));
RebornRegistry.registerItem(TRContent.SILVER_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, EquipmentSlot.FEET), "silver_boots"));
RebornRegistry.registerItem(TRContent.SILVER_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, ArmorItem.Type.HELMET), "silver_helmet"));
RebornRegistry.registerItem(TRContent.SILVER_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, ArmorItem.Type.CHESTPLATE), "silver_chestplate"));
RebornRegistry.registerItem(TRContent.SILVER_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, ArmorItem.Type.LEGGINGS), "silver_leggings"));
RebornRegistry.registerItem(TRContent.SILVER_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.SILVER, ArmorItem.Type.BOOTS), "silver_boots"));
RebornRegistry.registerItem(TRContent.STEEL_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.HEAD), "steel_helmet"));
RebornRegistry.registerItem(TRContent.STEEL_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.CHEST), "steel_chestplate"));
RebornRegistry.registerItem(TRContent.STEEL_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.LEGS), "steel_leggings"));
RebornRegistry.registerItem(TRContent.STEEL_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, EquipmentSlot.FEET), "steel_boots"));
RebornRegistry.registerItem(TRContent.STEEL_HELMET = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, ArmorItem.Type.HELMET), "steel_helmet"));
RebornRegistry.registerItem(TRContent.STEEL_CHESTPLATE = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, ArmorItem.Type.CHESTPLATE), "steel_chestplate"));
RebornRegistry.registerItem(TRContent.STEEL_LEGGINGS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, ArmorItem.Type.LEGGINGS), "steel_leggings"));
RebornRegistry.registerItem(TRContent.STEEL_BOOTS = InitUtils.setup(new TRArmourItem(TRArmorMaterials.STEEL, ArmorItem.Type.BOOTS), "steel_boots"));
// Battery
RebornRegistry.registerItem(TRContent.RED_CELL_BATTERY = InitUtils.setup(new BatteryItem(TechRebornConfig.redCellBatteryMaxCharge, RcEnergyTier.LOW), "red_cell_battery"));

View file

@ -25,6 +25,7 @@
package techreborn.init;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
@ -89,13 +90,13 @@ public enum TRArmorMaterials implements ArmorMaterial {
}
@Override
public int getDurability(EquipmentSlot slotIn) {
return MAX_DAMAGE_ARRAY[slotIn.getEntitySlotId()] * maxDamageFactor;
public int getDurability(ArmorItem.Type type) {
return MAX_DAMAGE_ARRAY[type.getEquipmentSlot().getEntitySlotId()] * maxDamageFactor;
}
@Override
public int getProtectionAmount(EquipmentSlot slotIn) {
return damageReductionAmountArray[slotIn.getEntitySlotId()];
public int getProtection(ArmorItem.Type type) {
return damageReductionAmountArray[type.getEquipmentSlot().getEntitySlotId()];
}
@Override

View file

@ -26,12 +26,16 @@ package techreborn.init;
import com.google.common.base.Preconditions;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.block.type.WoodTypeRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSetType;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.block.Material;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.block.WoodType;
import net.minecraft.entity.EntityType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
@ -152,6 +156,8 @@ import java.util.stream.Stream;
public class TRContent {
public static Marker DATAGEN = MarkerFactory.getMarker("datagen");
public static BlockSetType RUBBER_WOOD_SET_TYPE = BlockSetTypeRegistry.registerWood(new Identifier(TechReborn.MOD_ID, "rubber_wood"));
public static WoodType RUBBER_WOOD_TYPE = WoodTypeRegistry.register(new Identifier(TechReborn.MOD_ID, "rubber_wood"), RUBBER_WOOD_SET_TYPE);
// Misc Blocks
public static Block COMPUTER_CUBE;

View file

@ -0,0 +1,20 @@
package techreborn.init;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import techreborn.TechReborn;
public final class TRDamageTypes {
public static final RegistryKey<DamageType> ELECTRIC_SHOCK = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(TechReborn.MOD_ID, "electric_shock"));
public static final RegistryKey<DamageType> FUSION = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier(TechReborn.MOD_ID, "fusion"));
public static DamageSource create(World world, RegistryKey<DamageType> key) {
return new DamageSource(
world.getRegistryManager().get(RegistryKeys.DAMAGE_TYPE).entryOf(key)
);
}
}

View file

@ -59,7 +59,7 @@ public class TRDispenserBehavior {
public ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(pointer.getWorld());
int random = Random.create().nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0).copy();
ItemStack out = scrapboxRecipeList.get(random).getOutputs(null).get(0).copy();
stack.split(1);
Direction facing = pointer.getBlockState().get(DispenserBlock.FACING);

View file

@ -49,7 +49,7 @@ public class ScrapBoxItem extends Item {
if (!world.isClient) {
List<RebornRecipe> scrapboxRecipeList = ModRecipes.SCRAPBOX.getRecipes(world);
int random = world.random.nextInt(scrapboxRecipeList.size());
ItemStack out = scrapboxRecipeList.get(random).getOutputs().get(0);
ItemStack out = scrapboxRecipeList.get(random).getOutputs(world.getRegistryManager()).get(0);
WorldUtils.dropItem(out, world, player.getBlockPos());
stack.decrement(1);
}

View file

@ -41,7 +41,7 @@ public class BatpackItem extends ArmorItem implements RcEnergyItem {
public final RcEnergyTier tier;
public BatpackItem(int maxCharge, ArmorMaterial material, RcEnergyTier tier) {
super(material, EquipmentSlot.CHEST, new Settings().maxCount(1).maxDamage(-1));
super(material, Type.CHESTPLATE, new Settings().maxCount(1).maxDamage(-1));
this.maxCharge = maxCharge;
this.tier = tier;
}

View file

@ -44,7 +44,7 @@ public class CloakingDeviceItem extends TRArmourItem implements RcEnergyItem, Ar
// 40M FE capacity with 10k FE\t charge rate
public CloakingDeviceItem() {
super(TRArmorMaterials.CLOAKING_DEVICE, EquipmentSlot.CHEST, new Item.Settings().maxDamage(-1).maxCount(1));
super(TRArmorMaterials.CLOAKING_DEVICE, Type.CHESTPLATE, new Item.Settings().maxDamage(-1).maxCount(1));
}
@Override

View file

@ -57,25 +57,25 @@ public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTic
public final boolean enableFlight = TechRebornConfig.quantumSuitEnableFlight;
public QuantumSuitItem(ArmorMaterial material, EquipmentSlot slot) {
public QuantumSuitItem(ArmorMaterial material, Type slot) {
super(material, slot, new Item.Settings().maxDamage(-1).maxCount(1));
}
@Override
public Multimap<EntityAttribute, EntityAttributeModifier> getAttributeModifiers(ItemStack stack, EquipmentSlot equipmentSlot) {
var attributes = ArrayListMultimap.create(super.getAttributeModifiers(stack, slot));
var attributes = ArrayListMultimap.create(super.getAttributeModifiers(stack, getSlotType()));
attributes.removeAll(EntityAttributes.GENERIC_MOVEMENT_SPEED);
if (this.slot == EquipmentSlot.LEGS && equipmentSlot == EquipmentSlot.LEGS && enableSprint) {
if (this.getSlotType() == EquipmentSlot.LEGS && equipmentSlot == EquipmentSlot.LEGS && enableSprint) {
if (getStoredEnergy(stack) > sprintingCost) {
attributes.put(EntityAttributes.GENERIC_MOVEMENT_SPEED, new EntityAttributeModifier(MODIFIERS[equipmentSlot.getEntitySlotId()], "Movement Speed", 0.15, EntityAttributeModifier.Operation.ADDITION));
}
}
if (equipmentSlot == this.slot && getStoredEnergy(stack) > 0) {
attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[slot.getEntitySlotId()], "Armor modifier", 20, EntityAttributeModifier.Operation.ADDITION));
attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[slot.getEntitySlotId()], "Knockback modifier", 2, EntityAttributeModifier.Operation.ADDITION));
if (equipmentSlot == this.getSlotType() && getStoredEnergy(stack) > 0) {
attributes.put(EntityAttributes.GENERIC_ARMOR, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Armor modifier", 20, EntityAttributeModifier.Operation.ADDITION));
attributes.put(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, new EntityAttributeModifier(MODIFIERS[getSlotType().getEntitySlotId()], "Knockback modifier", 2, EntityAttributeModifier.Operation.ADDITION));
}
return ImmutableMultimap.copyOf(attributes);
@ -83,7 +83,7 @@ public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTic
@Override
public void tickArmor(ItemStack stack, PlayerEntity playerEntity) {
switch (this.slot) {
switch (this.getSlotType()) {
case HEAD:
if (playerEntity.isSubmergedInWater()) {
if (tryUseEnergy(stack, breathingCost)) {
@ -132,7 +132,7 @@ public class QuantumSuitItem extends TRArmourItem implements ArmorBlockEntityTic
@Override
public void onRemoved(PlayerEntity playerEntity) {
if (this.slot == EquipmentSlot.CHEST && enableFlight) {
if (this.getSlotType() == EquipmentSlot.CHEST && enableFlight) {
if (!playerEntity.isCreative() && !playerEntity.isSpectator()) {
playerEntity.getAbilities().allowFlying = false;
playerEntity.getAbilities().flying = false;

View file

@ -24,7 +24,6 @@
package techreborn.items.armor;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;
@ -44,11 +43,11 @@ public class TRArmourItem extends ArmorItem {
UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")
};
public TRArmourItem(ArmorMaterial material, EquipmentSlot slot) {
public TRArmourItem(ArmorMaterial material, Type slot) {
this(material, slot, new Item.Settings());
}
public TRArmourItem(ArmorMaterial material, EquipmentSlot slot, Item.Settings settings) {
public TRArmourItem(ArmorMaterial material, Type slot, Item.Settings settings) {
super(material, slot, settings);
}
}

View file

@ -27,6 +27,7 @@ package techreborn.items.tool.industrial;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.DamageSources;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -83,7 +84,7 @@ public class OmniToolItem extends MiningToolItem implements RcEnergyItem {
@Override
public boolean postHit(ItemStack stack, LivingEntity target, LivingEntity attacker) {
if (tryUseEnergy(stack, hitCost)) {
target.damage(DamageSource.player((PlayerEntity) attacker), 8F);
target.damage(target.getWorld().getDamageSources().playerAttack((PlayerEntity) attacker), 8F);
}
return false;
}

View file

@ -44,15 +44,6 @@ public class RecipeUtils {
return recipe.getIngredients().size() == 1 && recipe.getIngredients().get(0).test(input);
}
/**
* Used to get the matching output of a recipe type that only has 1 input
*/
public static <T extends Recipe<?>> ItemStack getMatchingRecipeOutput(World world, RecipeType<T> type, ItemStack input) {
return getMatchingRecipe(world, type, input)
.map(Recipe::getOutput)
.orElse(ItemStack.EMPTY);
}
public static <T extends Recipe<?>> List<Recipe<?>> getRecipes(World world, RecipeType<T> type) {
return world.getRecipeManager().values().stream().filter(iRecipe -> iRecipe.getType() == type).collect(Collectors.toList());
}

View file

@ -1,36 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.utils.damageSources;
import net.minecraft.entity.damage.DamageSource;
/**
* Created by modmuss50 on 06/03/2016.
*/
public class ElectricalShockSource extends DamageSource {
public ElectricalShockSource() {
super("shock");
}
}

View file

@ -1,36 +0,0 @@
/*
* This file is part of TechReborn, licensed under the MIT License (MIT).
*
* Copyright (c) 2020 TechReborn
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package techreborn.utils.damageSources;
import net.minecraft.entity.damage.DamageSource;
/**
* Created by modmuss50 on 05/03/2016.
*/
public class FusionDamageSource extends DamageSource {
public FusionDamageSource() {
super("fusion");
}
}

View file

@ -877,8 +877,8 @@
"techreborn.jei.category.generator.plasma": "Plasma Generator",
"_comment20": "Death Messages",
"death.attack.shock": "%s was electrocuted",
"death.attack.shock.player": "%s was electrocuted trying to outrun %s",
"death.attack.electric_shock": "%s was electrocuted",
"death.attack.electric_shock.player": "%s was electrocuted trying to outrun %s",
"_comment21": "Entities",
"entity.nuke": "Nuke",

View file

@ -30,12 +30,12 @@
]
},
"depends": {
"fabricloader": ">=0.14.11",
"fabric-api": ">=0.68.1",
"fabricloader": ">=0.14.15",
"fabric-api": ">=0.75.0",
"reborncore": "*",
"team_reborn_energy": ">=2.3.0",
"fabric-biome-api-v1": ">=3.0.0",
"minecraft": ">=1.19.3- <1.19.4-"
"minecraft": ">=1.19.4- <1.19.5-"
},
"accessWidener": "techreborn.accesswidener",
"authors": [