Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #1883

Merged
merged 4 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ jobs:
CHANGELOG.txt

- name: Update badge
uses: schneegans/[email protected]
continue-on-error: true
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 3ef501bc64c896a86fd706dfea8ba367
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// 1.20.1 2024-07-17T09:25:42.185311 Block States: projectred_expansion
// 1.20.1 2024-08-05T10:07:41.167181 Block States: projectred_expansion
b697bf3bc54738e649092c6b88cbb4fd9b3da8a3 assets/projectred_expansion/blockstates/auto_crafter.json
1d92e2503aa76e8cf9e908f7afa248a291fcf387 assets/projectred_expansion/blockstates/battery_box.json
325a4ac57dbf6f6f049812d1442992b5f7368d21 assets/projectred_expansion/blockstates/block_breaker.json
ac22e2b26c326b40d94951ed7a69b7b994f14aca assets/projectred_expansion/blockstates/charging_bench.json
2742c5200239a1933b73b45885d8d5fe0ec5ed3d assets/projectred_expansion/blockstates/deployer.json
fe88677fa2e1cf270a91e8e1ac1f8b598786949f assets/projectred_expansion/blockstates/fire_starter.json
8a3420edbfb56d655cb85fd209b893aab7af3509 assets/projectred_expansion/blockstates/frame.json
e285658b615ec1141d09ddb523656ad8dcd0c634 assets/projectred_expansion/blockstates/frame.json
2ea35b8dcec2486da65f2464436c04aba36624b1 assets/projectred_expansion/blockstates/frame_actuator.json
8a3420edbfb56d655cb85fd209b893aab7af3509 assets/projectred_expansion/blockstates/frame_motor.json
da1694043a21b0b85aa2918f534786f5e0de0cb7 assets/projectred_expansion/blockstates/frame_motor.json
97acab0b18004d35a03674349f4c14542707ad66 assets/projectred_expansion/blockstates/project_bench.json
99538255fa8dddf3c50e280e1e4d9f7d3248231c assets/projectred_expansion/blockstates/transposer.json
37c0bb69db6a7bdf44866469f4d8e0a69d22d137 assets/projectred_expansion/models/block/auto_crafter.json
Expand All @@ -33,7 +33,8 @@ d34961059b05c1caf2059ffba539b5ffc38c36a5 assets/projectred_expansion/models/bloc
9dbba6f59658244da05c4cdeaeb1691deef902d8 assets/projectred_expansion/models/block/frame_actuator.json
9130fd3156286ec9bcc1e958be94505d47cf1e36 assets/projectred_expansion/models/block/frame_actuator_state1.json
441616b7dbe0c0ec337ad807c7214514c45979dc assets/projectred_expansion/models/block/frame_actuator_state2.json
e528d8951b6212aff0082c9db8204f8b2c490fd4 assets/projectred_expansion/models/block/programmatically_rendered_block.json
176677c516b3203abbf46daed70cbcfcca83eab5 assets/projectred_expansion/models/block/frame_motor_programmatically_rendered.json
cf74edee7186e05fd24bd7fae56c2e23d1bd1de4 assets/projectred_expansion/models/block/frame_programmatically_rendered.json
645544cf14d5ca7f1577a11532a3321c06a51e18 assets/projectred_expansion/models/block/project_bench.json
17e1cc736c14625f137dbe9d5871e07d4eb85e73 assets/projectred_expansion/models/block/transposer.json
6bbf26b37dd2a946ced5c52327c3e4c860918566 assets/projectred_expansion/models/block/transposer_active.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"model": "projectred_expansion:block/auto_crafter_state1"
},
"charged=false,rotation=1,working=false": {
"model": "projectred_expansion:block/auto_crafter",
"model": "projectred_expansion:block/auto_crafter",ch
"y": 90
},
"charged=false,rotation=1,working=true": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"variants": {
"": {
"model": "projectred_expansion:block/programmatically_rendered_block"
"model": "projectred_expansion:block/frame_programmatically_rendered"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"variants": {
"": {
"model": "projectred_expansion:block/programmatically_rendered_block"
"model": "projectred_expansion:block/frame_motor_programmatically_rendered"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/block",
"textures": {
"particle": "projectred_expansion:block/frame_motor_top"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/block",
"textures": {
"particle": "projectred_expansion:block/frame"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package mrtjp.projectred.expansion.block;

import codechicken.lib.raytracer.VoxelShapeCache;
import codechicken.lib.render.particle.CustomParticleHandler;
import codechicken.lib.vec.*;
import com.google.common.collect.ImmutableSet;
import mrtjp.projectred.api.Frame;
import mrtjp.projectred.expansion.client.FrameModelRenderer;
import mrtjp.projectred.expansion.client.FrameModelVerts;
import mrtjp.projectred.lib.ModelVoxelShape;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
Expand All @@ -18,18 +16,13 @@
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.client.extensions.common.IClientBlockExtensions;
import net.minecraftforge.fml.DistExecutor;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Consumer;

public class FrameBlock extends Block implements Frame {

Expand All @@ -43,36 +36,6 @@ public FrameBlock() {
.dynamicShape()); // To prevent early caching before modelVerts can be loaded
}

@Override
public void initializeClient(Consumer<IClientBlockExtensions> consumer) {
consumer.accept(new IClientBlockExtensions() {
@Override
public boolean addHitEffects(BlockState state, Level level, HitResult hit, ParticleEngine engine) {
if (!(hit instanceof BlockHitResult blockHit)) {
return false;
}
CustomParticleHandler.addBlockHitEffects(
level,
Cuboid6.full.copy().add(blockHit.getBlockPos()),
blockHit.getDirection(),
FrameModelRenderer.getFrameIcon(),
engine
);
return true;
}

@Override
public boolean addDestroyEffects(BlockState state, Level level, BlockPos pos, ParticleEngine engine) {
CustomParticleHandler.addBlockDestroyEffects(
level,
Cuboid6.full.copy().add(pos),
Collections.singletonList(FrameModelRenderer.getFrameIcon()),
engine);
return true;
}
});
}

//region Frame
@Override
public boolean canGrab(Level w, BlockPos pos, Direction side) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,63 +1,24 @@
package mrtjp.projectred.expansion.block;

import codechicken.lib.render.particle.CustomParticleHandler;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Rotation;
import mrtjp.projectred.core.block.ProjectRedBlock;
import mrtjp.projectred.expansion.client.FrameMotorBlockRenderer;
import mrtjp.projectred.expansion.init.ExpansionBlocks;
import mrtjp.projectred.expansion.tile.FrameMotorTile;
import net.minecraft.client.particle.ParticleEngine;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.client.extensions.common.IClientBlockExtensions;
import org.jetbrains.annotations.Nullable;

import java.util.Collections;
import java.util.function.Consumer;

public class FrameMotorBlock extends ProjectRedBlock {

public FrameMotorBlock() {
super(STONE_PROPERTIES);
}

@Override
public void initializeClient(Consumer<IClientBlockExtensions> consumer) {
consumer.accept(new IClientBlockExtensions() {
@Override
public boolean addHitEffects(BlockState state, Level level, HitResult hit, ParticleEngine engine) {
if (!(hit instanceof BlockHitResult blockHit)) return false;
CustomParticleHandler.addBlockHitEffects(
level,
Cuboid6.full.copy().add(blockHit.getBlockPos()),
blockHit.getDirection(),
FrameMotorBlockRenderer.getParticleIcon(state, blockHit.getDirection().ordinal()),
engine
);
return true;
}

@Override
public boolean addDestroyEffects(BlockState state, Level level, BlockPos pos, ParticleEngine engine) {
CustomParticleHandler.addBlockDestroyEffects(
level,
Cuboid6.full.copy().add(pos),
Collections.singletonList(FrameMotorBlockRenderer.getParticleIcon(state, 0)),
engine);
return true;
}
});
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@ protected void registerStatesAndModels() {
addSideAndTopActiveModel(BLOCK_BREAKER_BLOCK.get());
addSidedOppositeMatchingFacesDeviceBlock(DEPLOYER_BLOCK.get());

// Advanced models rendered programmatically. Tied to dummy model to suppress warnings.
ModelFile dummy = models().withExistingParent("programmatically_rendered_block", "block");
simpleBlock(FRAME_BLOCK.get(), dummy);
simpleBlock(FRAME_MOTOR_BLOCK.get(), dummy);
// Advanced models rendered programmatically. Only Particle info provided by model file
addProgrammaticWithParticleTexture(FRAME_BLOCK.get(), "");
addProgrammaticWithParticleTexture(FRAME_MOTOR_BLOCK.get(), "_top");
}

private void addProgrammaticWithParticleTexture(Block block, String texSuffix) {
String blockName = ForgeRegistries.BLOCKS.getKey(block).getPath();
String texName = blockName + texSuffix;
ModelFile dummy = models()
.withExistingParent(blockName + "_programmatically_rendered", "block")
.texture("particle", "block/" + texName);
simpleBlock(block, dummy);
}

private void addRotatableOppositeMatchingFacesBlock(Block block) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ public MarbleCaveWorldCarver(Codec<CaveCarverConfiguration> codec) {

@Override
protected boolean canReplaceBlock(CaveCarverConfiguration pConfig, BlockState pState) {
// We must be able to carve the target wall type since we fill around every carved block
return super.canReplaceBlock(pConfig, pState) || pState.is(MARBLE_BLOCK.get());
// We must be able to carve the target wall type since we fill around every carved block.
//
// Air check is workaround for mods improperly adding air block tags to minecraft:overworld_carver_replaceables
// which causes marble caves to generate in the sky.
// https://github.com/MrTJP/ProjectRed/issues/1874
return !pState.isAir() && (super.canReplaceBlock(pConfig, pState) || pState.is(MARBLE_BLOCK.get()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public static class MultiplexerGate implements ICGate {
@Override
public void compute(ICSimulation ic, int[] inputs, int[] outputs) {

boolean in0 = ic.getRegByteVal(inputs[0]) != 0;
boolean in1 = ic.getRegByteVal(inputs[1]) != 0;
boolean in2 = ic.getRegByteVal(inputs[2]) != 0;
boolean in0 = ic.getRegByteVal(inputs[0]) != 0; // Right
boolean in1 = ic.getRegByteVal(inputs[1]) != 0; // Bottom
boolean in2 = ic.getRegByteVal(inputs[2]) != 0; // Left

ic.queueRegByteVal(outputs[0], in0 ?
(byte) (in1 ? 1 : 0) :
(byte) (in2 ? 1 : 0));
ic.queueRegByteVal(outputs[0], in1 ?
(byte) (in2 ? 1 : 0) :
(byte) (in0 ? 1 : 0));
}
}
}
Loading