Merge remote-tracking branch 'upstream/1.17' into 1.17

This commit is contained in:
Frank Bauer 2021-07-09 11:16:43 +02:00
commit 60f07ab437
6 changed files with 43 additions and 25 deletions

View file

@ -8,7 +8,7 @@ yarn_mappings= 6
loader_version= 0.11.6 loader_version= 0.11.6
# Mod Properties # Mod Properties
mod_version = 0.10.0-pre mod_version = 0.10.1-pre
maven_group = ru.betterend maven_group = ru.betterend
archives_base_name = better-end archives_base_name = better-end

View file

@ -58,7 +58,7 @@ public class CavePumpkinBlock extends BaseBlockNotFull implements IRenderTyped {
VoxelShape top = Block.box(5, 15, 5, 11, 16, 11); VoxelShape top = Block.box(5, 15, 5, 11, 16, 11);
SHAPE_BIG = Shapes.or(lantern, cap, top); SHAPE_BIG = Shapes.or(lantern, cap, top);
lantern = Block.box(1, 7, 1, 15, 13, 15); lantern = Block.box(5, 7, 5, 11, 13, 11);
cap = Block.box(4, 12, 4, 12, 15, 12); cap = Block.box(4, 12, 4, 12, 15, 12);
top = Block.box(6, 15, 6, 10, 16, 10); top = Block.box(6, 15, 6, 10, 16, 10);
SHAPE_SMALL = Shapes.or(lantern, cap, top); SHAPE_SMALL = Shapes.or(lantern, cap, top);

View file

@ -6,12 +6,16 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;
import ru.betterend.blocks.basis.PedestalBlock; import ru.betterend.blocks.basis.PedestalBlock;
import ru.betterend.blocks.entities.InfusionPedestalEntity; import ru.betterend.blocks.entities.InfusionPedestalEntity;
import ru.betterend.blocks.entities.PedestalBlockEntity;
import ru.betterend.rituals.InfusionRitual; import ru.betterend.rituals.InfusionRitual;
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -73,6 +77,12 @@ public class InfusionPedestal extends PedestalBlock {
return super.getShape(state, world, pos, context); return super.getShape(state, world, pos, context);
} }
@Override
@Nullable
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
return InfusionPedestalEntity::tickEnity;
}
static { static {
VoxelShape basinUp = Block.box(2, 3, 2, 14, 4, 14); VoxelShape basinUp = Block.box(2, 3, 2, 14, 4, 14);
VoxelShape basinDown = Block.box(0, 0, 0, 16, 3, 16); VoxelShape basinDown = Block.box(0, 0, 0, 16, 3, 16);

View file

@ -3,6 +3,7 @@ package ru.betterend.blocks.entities;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import ru.betterend.registry.EndBlockEntities; import ru.betterend.registry.EndBlockEntities;
import ru.betterend.rituals.InfusionRitual; import ru.betterend.rituals.InfusionRitual;
@ -26,15 +27,6 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
} }
} }
public void setLevelAndPosition(Level world, BlockPos pos) {
if (hasRitual()) {
linkedRitual.setLocation(world, pos);
}
else {
linkRitual(new InfusionRitual(this, world, pos));
}
}
public void linkRitual(InfusionRitual ritual) { public void linkRitual(InfusionRitual ritual) {
linkedRitual = ritual; linkedRitual = ritual;
} }
@ -47,13 +39,6 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
return linkedRitual != null; return linkedRitual != null;
} }
public static void tick(Level tickLevel, BlockPos tickPos, BlockState tickState, InfusionPedestalEntity blockEntity) {
if (blockEntity.hasRitual()) {
blockEntity.linkedRitual.tick();
}
PedestalBlockEntity.tick(tickLevel, tickPos, tickState, blockEntity);
}
@Override @Override
public CompoundTag save(CompoundTag tag) { public CompoundTag save(CompoundTag tag) {
if (hasRitual()) { if (hasRitual()) {
@ -70,4 +55,14 @@ public class InfusionPedestalEntity extends PedestalBlockEntity {
linkedRitual.fromTag(tag.getCompound("ritual")); linkedRitual.fromTag(tag.getCompound("ritual"));
} }
} }
public static <T extends BlockEntity> void tickEnity(Level level, BlockPos blockPos, BlockState blockState, T uncastedEntity) {
if (uncastedEntity instanceof InfusionPedestalEntity) {
InfusionPedestalEntity blockEntity = (InfusionPedestalEntity) uncastedEntity;
if (blockEntity.hasRitual()) {
blockEntity.linkedRitual.tick();
}
PedestalBlockEntity.tick(level, blockPos, blockState, blockEntity);
}
}
} }

View file

@ -18,6 +18,7 @@ import org.jetbrains.annotations.NotNull;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionDisplay> { public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionDisplay> {
@ -44,7 +45,6 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
return ICON; return ICON;
} }
@Override @Override
public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) { public @NotNull List<Widget> setupDisplay(REIInfusionDisplay display, Rectangle bounds) {
Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2); Point centerPoint = new Point(bounds.getCenterX() - 34, bounds.getCenterY() - 2);
@ -52,6 +52,14 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
widgets.add(Widgets.createRecipeBase(bounds)); widgets.add(Widgets.createRecipeBase(bounds));
List<EntryIngredient> inputEntries = display.getInputEntries(); List<EntryIngredient> inputEntries = display.getInputEntries();
List<EntryIngredient> outputEntries = display.getOutputEntries(); List<EntryIngredient> outputEntries = display.getOutputEntries();
if (inputEntries.size() < 9) {
List<EntryIngredient> newList = new ArrayList<EntryIngredient>(9);
newList.addAll(inputEntries);
for (int i = inputEntries.size(); i < 9; i++) {
newList.add(EntryIngredient.empty());
}
inputEntries = newList;
}
widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104)); widgets.add(Widgets.createTexturedWidget(BACKGROUND, bounds.x, bounds.y, 0, 0, 150, 104, 150, 104));
widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput()); widgets.add(Widgets.createSlot(centerPoint).entries(inputEntries.get(0)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x, centerPoint.y - 28)).entries(inputEntries.get(1)).disableBackground().markInput());
@ -63,8 +71,15 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y + 24)).entries(inputEntries.get(6)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x - 24, centerPoint.y - 24)).entries(inputEntries.get(8)).disableBackground().markInput());
widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput()); widgets.add(Widgets.createSlot(new Point(centerPoint.x + 80, centerPoint.y)).entries(outputEntries.get(0)).disableBackground().markOutput());
widgets.add(Widgets.createLabel(new Point(bounds.getMaxX() - 5, bounds.y + 6), new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime())) widgets.add(
.noShadow().rightAligned().color(0xFF404040, 0xFFBBBBBB)); Widgets.createLabel(
new Point(bounds.getMaxX() - 5, bounds.y + 6),
new TranslatableComponent("category.rei.infusion.time&val", display.getInfusionTime())
)
.noShadow()
.rightAligned()
.color(0xFF404040, 0xFFBBBBBB)
);
return widgets; return widgets;
} }
@ -74,7 +89,5 @@ public class REIInfusionCategory implements TransferDisplayCategory<REIInfusionD
} }
@Override @Override
public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIInfusionDisplay display, IntList redSlots) { public void renderRedSlots(PoseStack matrices, List<Widget> widgets, Rectangle bounds, REIInfusionDisplay display, IntList redSlots) {}
}
} }

View file

@ -72,7 +72,7 @@ public class EndDragonFightMixin {
BlockPos center = GeneratorOptions.getPortalPos().above(5); BlockPos center = GeneratorOptions.getPortalPos().above(5);
for (Direction dir : BlocksHelper.HORIZONTAL) { for (Direction dir : BlocksHelper.HORIZONTAL) {
BlockPos central = center.relative(dir, 4); BlockPos central = center.relative(dir, 4);
List<EndCrystal> crystalList = level.getEntitiesOfClass(EndCrystal.class, new AABB(central.below(10).south().west(), central.above(10).north().east())); List<EndCrystal> crystalList = level.getEntitiesOfClass(EndCrystal.class, new AABB(central.below(255).south().west(), central.above(255).north().east()));
int count = crystalList.size(); int count = crystalList.size();
for (int n = 0; n < count; n++) { for (int n = 0; n < count; n++) {