-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix server class loading issue caused by the fluid pipes
- Loading branch information
1 parent
fcd8c94
commit 219c211
Showing
18 changed files
with
205 additions
and
110 deletions.
There are no files selected for viewing
126 changes: 51 additions & 75 deletions
126
common/src/main/java/com/copycatsplus/copycats/CCBlocks.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
common/src/main/java/com/copycatsplus/copycats/foundation/copycat/model/ModelUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.copycatsplus.copycats.foundation.copycat.model; | ||
|
||
import com.copycatsplus.copycats.utility.Platform; | ||
import com.simibubi.create.foundation.data.CreateRegistrate; | ||
import com.tterrag.registrate.util.nullness.NonNullConsumer; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.resources.model.BakedModel; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
|
||
import java.util.function.Function; | ||
|
||
@Environment(EnvType.CLIENT) | ||
public class ModelUtils { | ||
|
||
@SafeVarargs | ||
@Environment(EnvType.CLIENT) | ||
public static <Model extends CopycatModelCore> NonNullConsumer<? super Block> createKineticModel(Function<BakedModel, BakedModel> original, Model... model) { | ||
return CreateRegistrate.blockModel(() -> m -> CopycatModelCore.createModel(original.apply(m), CopycatModelCore.kinetic(model))); | ||
} | ||
|
||
@Environment(EnvType.CLIENT) | ||
public static BakedModel getModelFor(BlockState mat) { | ||
return Platform.Environment.CLIENT.returnElseCurrent(() -> getModelOf(mat)); | ||
} | ||
|
||
/** | ||
* Helper method to get the model of a block state. | ||
* | ||
* @param state The block state to get the model of. | ||
* @return The baked model of the block state. | ||
*/ | ||
@Environment(EnvType.CLIENT) | ||
public static BakedModel getModelOf(BlockState state) { | ||
return Minecraft.getInstance() | ||
.getBlockRenderer() | ||
.getBlockModel(state); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
fabric/src/main/java/com/copycatsplus/copycats/fabric/CCBlocksImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
package com.copycatsplus.copycats.fabric; | ||
|
||
import com.copycatsplus.copycats.foundation.copycat.model.CopycatModelCore; | ||
import com.copycatsplus.copycats.content.copycat.fluid_pipe.fabric.CopycatFluidPipeModelFabric; | ||
import com.tterrag.registrate.providers.DataGenContext; | ||
import com.tterrag.registrate.providers.RegistrateBlockstateProvider; | ||
import net.minecraft.client.resources.model.BakedModel; | ||
import net.minecraft.world.level.block.Block; | ||
|
||
public class CCBlocksImpl { | ||
|
||
public static void getWrappedBlockState(DataGenContext<Block, ? extends Block> c, RegistrateBlockstateProvider p, String name) { | ||
p.simpleBlock(c.getEntry(), p.models().withExistingParent(name, "block/barrier")); | ||
} | ||
|
||
public static BakedModel getFluidPipeModel(BakedModel original, CopycatModelCore copycat) { | ||
return new CopycatFluidPipeModelFabric(original, copycat); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.