-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand Textured Block api to provide common invisible block, expose b…
…aking chunk in ChunkAttachment, add overridable methods for when attachment is set or removed, make ElementHolders tick for spectators, stop logging ItemGroup errors unless requested in config
- Loading branch information
Showing
15 changed files
with
147 additions
and
41 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
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
6 changes: 6 additions & 0 deletions
6
polymer-blocks/src/main/resources/assets/polymer/models/block/empty.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"textures": { | ||
"particle": "polymer:block/empty" | ||
}, | ||
"elements": [] | ||
} |
Binary file added
BIN
+75 Bytes
polymer-blocks/src/main/resources/assets/polymer/textures/block/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
polymer-blocks/src/testmod/java/eu/pb4/blocktest/EmptyBlock.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,24 @@ | ||
package eu.pb4.blocktest; | ||
|
||
import eu.pb4.polymer.blocks.api.BlockModelType; | ||
import eu.pb4.polymer.blocks.api.PolymerBlockModel; | ||
import eu.pb4.polymer.blocks.api.PolymerBlockResourceUtils; | ||
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockState; | ||
import net.minecraft.util.Identifier; | ||
|
||
public class EmptyBlock extends Block implements PolymerTexturedBlock { | ||
private final BlockState polymerBlockState; | ||
|
||
public EmptyBlock(Settings settings, BlockModelType type) { | ||
super(settings); | ||
this.polymerBlockState = PolymerBlockResourceUtils.requestEmpty(type); | ||
|
||
} | ||
|
||
@Override | ||
public BlockState getPolymerBlockState(BlockState state) { | ||
return this.polymerBlockState; | ||
} | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
...ntity/src/main/java/eu/pb4/polymer/virtualentity/mixin/block/ServerChunkManagerMixin.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,34 @@ | ||
package eu.pb4.polymer.virtualentity.mixin.block; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import eu.pb4.polymer.virtualentity.impl.HolderAttachmentHolder; | ||
import eu.pb4.polymer.virtualentity.impl.HolderHolder; | ||
import net.minecraft.server.world.ServerChunkManager; | ||
import net.minecraft.world.chunk.WorldChunk; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(ServerChunkManager.class) | ||
public class ServerChunkManagerMixin { | ||
@Inject(method = "tickChunks", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V")) | ||
private void tickElementHoldersEvenIfBlocksDont(CallbackInfo ci, @Local List<ServerChunkManager.ChunkWithHolder> chunkList) { | ||
chunkList.forEach(this::tickHolders); | ||
} | ||
|
||
@Unique | ||
private void tickHolders(ServerChunkManager.ChunkWithHolder chunkWithHolder) { | ||
var holo = ((HolderAttachmentHolder) chunkWithHolder.chunk()).polymerVE$getHolders(); | ||
|
||
if (!holo.isEmpty()) { | ||
var arr = holo.toArray(HolderHolder.HOLDER_ATTACHMENTS); | ||
for (int i = 0; i < arr.length; i++) { | ||
arr[i].tick(); | ||
} | ||
} | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
...rtual-entity/src/main/java/eu/pb4/polymer/virtualentity/mixin/block/ServerWorldMixin.java
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
polymer-virtual-entity/src/main/resources/polymer-virtual-entity.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
accessWidener v1 named | ||
|
||
accessible class net/minecraft/server/world/ServerChunkLoadingManager$EntityTracker | ||
accessible class net/minecraft/server/world/ServerChunkManager$ChunkWithHolder |
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