Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
bc92c9084c
|
@ -12,7 +12,7 @@ buildscript {
|
|||
apply plugin: 'net.minecraftforge.gradle'
|
||||
|
||||
group = 'com.buuz135'
|
||||
version = '1.18.2-0.0.19'
|
||||
version = '1.18.2-0.0.20'
|
||||
|
||||
java {
|
||||
archivesBaseName = 'functionalstorage'
|
||||
|
|
|
@ -48,6 +48,11 @@ public class CompactingDrawerTile extends ControllableDrawerTile<CompactingDrawe
|
|||
return CompactingDrawerTile.this.isVoid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDowngrade() {
|
||||
return CompactingDrawerTile.this.hasDowngrade();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocked() {
|
||||
return CompactingDrawerTile.this.isLocked();
|
||||
|
|
|
@ -6,14 +6,15 @@ import com.hrznstudio.titanium.util.RayTraceUtils;
|
|||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
|
@ -22,7 +23,7 @@ import net.minecraft.world.phys.shapes.BooleanOp;
|
|||
import net.minecraft.world.phys.shapes.Shapes;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.OptionalDouble;
|
||||
|
||||
import static com.buuz135.functionalstorage.item.LinkingToolItem.NBT_CONTROLLER;
|
||||
|
@ -48,21 +49,36 @@ public class ControllerRenderer implements BlockEntityRenderer<DrawerControllerT
|
|||
.createCompositeState(false));
|
||||
|
||||
|
||||
private static void renderShape(PoseStack p_109783_, VertexConsumer p_109784_, VoxelShape p_109785_, double p_109786_, double p_109787_, double p_109788_, float p_109789_, float p_109790_, float p_109791_, float p_109792_) {
|
||||
PoseStack.Pose posestack$pose = p_109783_.last();
|
||||
p_109785_.forAllEdges((p_194324_, p_194325_, p_194326_, p_194327_, p_194328_, p_194329_) -> {
|
||||
float f = (float) (p_194327_ - p_194324_);
|
||||
float f1 = (float) (p_194328_ - p_194325_);
|
||||
float f2 = (float) (p_194329_ - p_194326_);
|
||||
float f3 = Mth.sqrt(f * f + f1 * f1 + f2 * f2);
|
||||
f /= f3;
|
||||
f1 /= f3;
|
||||
f2 /= f3;
|
||||
p_109784_.vertex(posestack$pose.pose(), (float) (p_194324_ + p_109786_), (float) (p_194325_ + p_109787_), (float) (p_194326_ + p_109788_)).color(p_109789_, p_109790_, p_109791_, p_109792_).normal(posestack$pose.normal(), f, f1, f2).endVertex();
|
||||
p_109784_.vertex(posestack$pose.pose(), (float) (p_194327_ + p_109786_), (float) (p_194328_ + p_109787_), (float) (p_194329_ + p_109788_)).color(p_109789_, p_109790_, p_109791_, p_109792_).normal(posestack$pose.normal(), f, f1, f2).endVertex();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawerControllerTile tile, float partialTicks, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
|
||||
ItemStack stack = Minecraft.getInstance().player.getMainHandItem();
|
||||
if (stack.isEmpty()) return;
|
||||
if (stack.getItem() instanceof LinkingToolItem){
|
||||
if (stack.getItem() instanceof LinkingToolItem) {
|
||||
CompoundTag controllerNBT = stack.getOrCreateTag().getCompound(NBT_CONTROLLER);
|
||||
BlockPos controller = new BlockPos(controllerNBT.getInt("X"), controllerNBT.getInt("Y"), controllerNBT.getInt("Z"));
|
||||
if (!controller.equals(tile.getBlockPos())) return;
|
||||
if (stack.getOrCreateTag().contains(NBT_FIRST)){
|
||||
if (stack.getOrCreateTag().contains(NBT_FIRST)) {
|
||||
CompoundTag firstpos = stack.getOrCreateTag().getCompound(NBT_FIRST);
|
||||
BlockPos firstPos = new BlockPos(firstpos.getInt("X"), firstpos.getInt("Y"), firstpos.getInt("Z"));
|
||||
HitResult result = RayTraceUtils.rayTraceSimple(Minecraft.getInstance().level, Minecraft.getInstance().player, 8, partialTicks);
|
||||
if (result.getType() == HitResult.Type.BLOCK){
|
||||
BlockPos hit = ((BlockHitResult)result).getBlockPos();
|
||||
AABB aabb = new AABB(Math.min(firstPos.getX(), hit.getX()),Math.min(firstPos.getY(), hit.getY()),Math.min(firstPos.getZ(), hit.getZ()), Math.max(firstPos.getX(), hit.getX()) + 1,Math.max(firstPos.getY(), hit.getY())+1,Math.max(firstPos.getZ(), hit.getZ())+1) ;
|
||||
AABB aabb = new AABB(Math.min(firstPos.getX(), hit.getX()), Math.min(firstPos.getY(), hit.getY()), Math.min(firstPos.getZ(), hit.getZ()), Math.max(firstPos.getX(), hit.getX()) + 1, Math.max(firstPos.getY(), hit.getY()) + 1, Math.max(firstPos.getZ(), hit.getZ()) + 1);
|
||||
VoxelShape shape = Shapes.create(aabb);
|
||||
LevelRenderer.renderVoxelShape(matrixStack, bufferIn.getBuffer(TYPE), shape, -controller.getX(), -controller.getY(), -controller.getZ(), 1f, 1f, 1f, 1f);
|
||||
return;
|
||||
|
@ -72,7 +88,19 @@ public class ControllerRenderer implements BlockEntityRenderer<DrawerControllerT
|
|||
for (Long connectedDrawer : tile.getConnectedDrawers().getConnectedDrawers()) {
|
||||
shape = Shapes.join(shape, Shapes.create(new AABB(BlockPos.of(connectedDrawer))), BooleanOp.OR);
|
||||
}
|
||||
LevelRenderer.renderVoxelShape(matrixStack, bufferIn.getBuffer(TYPE), shape, -tile.getBlockPos().getX(), -tile.getBlockPos().getY(), -tile.getBlockPos().getZ(), 1f, 1f, 1f, 1f);
|
||||
//LevelRenderer.renderVoxelShape(matrixStack, bufferIn.getBuffer(TYPE), shape, -tile.getBlockPos().getX(), -tile.getBlockPos().getY(), -tile.getBlockPos().getZ(), 1f, 1f, 1f, 1f);
|
||||
List<AABB> list = shape.toAabbs();
|
||||
int i = Mth.ceil((double) list.size() / 3.0D);
|
||||
|
||||
for (int j = 0; j < list.size(); ++j) {
|
||||
AABB aabb = list.get(j);
|
||||
float f = ((float) j % (float) i + 1.0F) / (float) i;
|
||||
float f1 = (float) (j / i);
|
||||
float f2 = 1;
|
||||
float f3 = 1;
|
||||
float f4 = 1;
|
||||
renderShape(matrixStack, bufferIn.getBuffer(TYPE), Shapes.create(aabb.move(0.0D, 0.0D, 0.0D)), -tile.getBlockPos().getX(), -tile.getBlockPos().getY(), -tile.getBlockPos().getZ(), f2, f3, f4, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -137,11 +137,16 @@ public abstract class CompactingInventoryHandler implements IItemHandler, INBTSe
|
|||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
if (slot == 3) return Integer.MAX_VALUE;
|
||||
return (int) Math.min(Integer.MAX_VALUE, Math.floor((TOTAL_AMOUNT * getMultiplier()) / this.resultList.get(slot).getNeeded()));
|
||||
int total = TOTAL_AMOUNT;
|
||||
if (hasDowngrade()) total = 64 * 9 * 9;
|
||||
return (int) Math.min(Integer.MAX_VALUE, Math.floor((total * getMultiplier()) / this.resultList.get(slot).getNeeded()));
|
||||
}
|
||||
|
||||
public int getSlotLimitBase(int slot){
|
||||
return (int) Math.min(Integer.MAX_VALUE, Math.floor(TOTAL_AMOUNT / this.resultList.get(slot).getNeeded()));
|
||||
public int getSlotLimitBase(int slot) {
|
||||
if (slot == 3) return Integer.MAX_VALUE;
|
||||
int total = TOTAL_AMOUNT;
|
||||
if (hasDowngrade()) total = 64 * 9 * 9;
|
||||
return (int) Math.min(Integer.MAX_VALUE, Math.floor(total / this.resultList.get(slot).getNeeded()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -197,4 +202,6 @@ public abstract class CompactingInventoryHandler implements IItemHandler, INBTSe
|
|||
public ItemStack getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public abstract boolean hasDowngrade();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
"block.functionalstorage.warped_1": "诡异木抽屉(1x1)",
|
||||
"block.functionalstorage.warped_2": "诡异木抽屉(1x2)",
|
||||
"block.functionalstorage.warped_4": "诡异木抽屉(2x2)",
|
||||
"block.functionalstorage.framed_1": "镶框抽屉(1x1)",
|
||||
"block.functionalstorage.framed_2": "镶框抽屉(1x2)",
|
||||
"block.functionalstorage.framed_4": "镶框抽屉(2x2)",
|
||||
"block.functionalstorage.compacting_framed_drawer": "压缩镶框抽屉",
|
||||
"configurationtool.configmode": "配置模式:",
|
||||
"configurationtool.configmode.locking": "锁定",
|
||||
"configurationtool.configmode.toggle_numbers": "隐藏/显示数量",
|
||||
|
@ -48,7 +52,7 @@
|
|||
"item.utility.direction": "方向:",
|
||||
"item.utility.direction.desc": "在GUI中右击变更方向",
|
||||
"item.utility.downgrade": "栏位堆叠上限降级为64",
|
||||
"itemGroup.functionalstorage": "Functional Storage",
|
||||
"itemGroup.functionalstorage": "功能性存储",
|
||||
"key.categories.storage": "存储",
|
||||
"key.categories.utility": "功能",
|
||||
"linkingtool.controller": "控制器:",
|
||||
|
@ -66,5 +70,6 @@
|
|||
"storageupgrade.desc": "存储上限×",
|
||||
"upgrade.type": "种类:",
|
||||
"upgrade.type.storage": "存储",
|
||||
"upgrade.type.utility": "功能"
|
||||
"upgrade.type.utility": "功能",
|
||||
"frameddrawer.use": "如何改变材质:\n在合成界面,第一个栏位放置用做抽屉外纹理的方块,第二个栏位放置用做抽屉内纹理的方块,第三个栏位放置镶框抽屉。\n"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user