Sync tile entity when book texture changes
This commit is contained in:
@@ -196,6 +196,11 @@ public class BlockBookshelf extends BlockHorizontal implements ITileEntityProvid
|
|||||||
return bookTextures == null ? ImmutableList.copyOf(BOOK_TEXTURE_MAP.values()) : bookTextures;
|
return bookTextures == null ? ImmutableList.copyOf(BOOK_TEXTURE_MAP.values()) : bookTextures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the list of registered book items, in ID order. */
|
||||||
|
public static ImmutableList<Item> getBookItems(){
|
||||||
|
return bookItems;
|
||||||
|
}
|
||||||
|
|
||||||
/** Called during block registration to initialise the block properties for each book. */
|
/** Called during block registration to initialise the block properties for each book. */
|
||||||
public static void initBookProperties(){
|
public static void initBookProperties(){
|
||||||
for(int i=0; i<SLOT_COUNT; i++){
|
for(int i=0; i<SLOT_COUNT; i++){
|
||||||
|
|||||||
@@ -139,7 +139,9 @@ public class ContainerBookshelf extends Container {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStack(ItemStack stack){
|
public void putStack(ItemStack stack){
|
||||||
boolean statusChanged = this.getStack().isEmpty() != stack.isEmpty();
|
boolean statusChanged = this.getStack().isEmpty() != stack.isEmpty()
|
||||||
|
|| BlockBookshelf.getBookItems().indexOf(this.getStack().getItem())
|
||||||
|
!= BlockBookshelf.getBookItems().indexOf(stack.getItem());
|
||||||
super.putStack(stack);
|
super.putStack(stack);
|
||||||
if(statusChanged) ContainerBookshelf.this.onSlotChanged();
|
if(statusChanged) ContainerBookshelf.this.onSlotChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user