-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fabric BlockView API v2 * Fix dependency on nonexistent module * Add test for biome getter * Improve getBiomeFabric documentation * Simplify javadoc (cherry picked from commit 92a0d36)
- Loading branch information
1 parent
ceabd76
commit 73761d2
Showing
39 changed files
with
746 additions
and
249 deletions.
There are no files selected for viewing
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,3 @@ | ||
version = getSubprojectVersion(project) | ||
|
||
moduleDependencies(project, ['fabric-block-view-api-v2']) |
46 changes: 46 additions & 0 deletions
46
...t-v1/src/main/java/net/fabricmc/fabric/api/rendering/data/v1/RenderAttachedBlockView.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,46 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.api.rendering.data.v1; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.BlockRenderView; | ||
import net.minecraft.world.WorldView; | ||
|
||
import net.fabricmc.fabric.api.blockview.v2.FabricBlockView; | ||
|
||
/** | ||
* This interface is guaranteed to be implemented on all {@link WorldView} instances. | ||
* It is likely to be implemented on any given {@link BlockRenderView} instance, but | ||
* this is not guaranteed. | ||
* | ||
* @deprecated Use {@link FabricBlockView} instead. | ||
*/ | ||
@Deprecated | ||
public interface RenderAttachedBlockView extends BlockRenderView { | ||
/** | ||
* This method will call {@link FabricBlockView#getBlockEntityRenderData(BlockPos)} by default. | ||
* | ||
* @deprecated Use {@link FabricBlockView#getBlockEntityRenderData(BlockPos)} instead. | ||
*/ | ||
@Deprecated | ||
@Nullable | ||
default Object getBlockEntityRenderAttachment(BlockPos pos) { | ||
return getBlockEntityRenderData(pos); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
.../src/main/java/net/fabricmc/fabric/api/rendering/data/v1/RenderAttachmentBlockEntity.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 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.api.rendering.data.v1; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import net.minecraft.block.entity.BlockEntity; | ||
|
||
import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity; | ||
|
||
/** | ||
* This interface is guaranteed to be implemented on all {@link BlockEntity} instances. | ||
* | ||
* @deprecated Use {@link RenderDataBlockEntity} instead. | ||
*/ | ||
@Deprecated | ||
@FunctionalInterface | ||
public interface RenderAttachmentBlockEntity { | ||
/** | ||
* This method will be automatically called if {@link RenderDataBlockEntity#getRenderData()} is not overridden. | ||
* | ||
* @deprecated Use {@link RenderDataBlockEntity#getRenderData()} instead. | ||
*/ | ||
@Deprecated | ||
@Nullable | ||
Object getRenderAttachmentData(); | ||
} |
43 changes: 43 additions & 0 deletions
43
...ttachment-v1/src/main/java/net/fabricmc/fabric/mixin/rendering/data/BlockEntityMixin.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,43 @@ | ||
/* | ||
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.fabricmc.fabric.mixin.rendering.data; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
import net.minecraft.block.entity.BlockEntity; | ||
|
||
import net.fabricmc.fabric.api.blockview.v2.RenderDataBlockEntity; | ||
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachmentBlockEntity; | ||
|
||
@Mixin(BlockEntity.class) | ||
public class BlockEntityMixin implements RenderAttachmentBlockEntity, RenderDataBlockEntity { | ||
@Override | ||
@Nullable | ||
public Object getRenderAttachmentData() { | ||
return null; | ||
} | ||
|
||
/** | ||
* Instead of returning null by default in v2, proxy to v1 method instead. | ||
*/ | ||
@Override | ||
@Nullable | ||
public Object getRenderData() { | ||
return getRenderAttachmentData(); | ||
} | ||
} |
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
File renamed without changes
4 changes: 2 additions & 2 deletions
4
...-rendering-data-attachment-v1.mixins.json → ...-rendering-data-attachment-v1.mixins.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version = getSubprojectVersion(project) | ||
|
||
loom { | ||
accessWidenerPath = file("src/main/resources/fabric-block-view-api-v2.accesswidener") | ||
} |
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
Oops, something went wrong.