From 17aaeec7dc5088ccbb606f1b24aab23c3c321b16 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 9 Mar 2019 13:18:06 +0200 Subject: [PATCH] Added out own textures for the spellbook and added a second variant --- .../unicopia/entity/EntitySpellbook.java | 14 ++++++++++++++ .../unicopia/render/RenderSpellbook.java | 5 +++-- .../textures/entity/enchanting_table_book.png | Bin 0 -> 1015 bytes .../entity/enchanting_table_book_blue.png | Bin 0 -> 471 bytes 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/assets/unicopia/textures/entity/enchanting_table_book.png create mode 100644 src/main/resources/assets/unicopia/textures/entity/enchanting_table_book_blue.png diff --git a/src/main/java/com/minelittlepony/unicopia/entity/EntitySpellbook.java b/src/main/java/com/minelittlepony/unicopia/entity/EntitySpellbook.java index 53ef2aff..1623f1c5 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/EntitySpellbook.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/EntitySpellbook.java @@ -25,12 +25,17 @@ import net.minecraft.world.World; public class EntitySpellbook extends EntityLiving implements IMagicals { private static final DataParameter OPENED = EntityDataManager.createKey(EntitySpellbook.class, DataSerializers.BOOLEAN); + private static final DataParameter ALTERED = EntityDataManager.createKey(EntitySpellbook.class, DataSerializers.BOOLEAN); private static final DataParameter OPENED_USER = EntityDataManager.createKey(EntitySpellbook.class, DataSerializers.BYTE); public EntitySpellbook(World worldIn) { super(worldIn); setSize(0.6f, 0.6f); enablePersistence(); + + if (world.rand.nextInt(3) == 0) { + setAltered(); + } } @Override @@ -38,6 +43,7 @@ public class EntitySpellbook extends EntityLiving implements IMagicals { super.entityInit(); dataManager.register(OPENED, true); dataManager.register(OPENED_USER, (byte)1); + dataManager.register(ALTERED, false); } @Override @@ -55,6 +61,14 @@ public class EntitySpellbook extends EntityLiving implements IMagicals { return false; } + public boolean getIsAltered() { + return dataManager.get(ALTERED); + } + + public void setAltered() { + dataManager.set(ALTERED, true); + } + public boolean getIsOpen() { return dataManager.get(OPENED); } diff --git a/src/main/java/com/minelittlepony/unicopia/render/RenderSpellbook.java b/src/main/java/com/minelittlepony/unicopia/render/RenderSpellbook.java index 1ff841d9..5b5a4752 100644 --- a/src/main/java/com/minelittlepony/unicopia/render/RenderSpellbook.java +++ b/src/main/java/com/minelittlepony/unicopia/render/RenderSpellbook.java @@ -11,7 +11,8 @@ import net.minecraft.util.ResourceLocation; public class RenderSpellbook extends RenderLiving { - private static final ResourceLocation texture = new ResourceLocation("textures/entity/enchanting_table_book.png"); + private static final ResourceLocation BLUE = new ResourceLocation("unicopia", "textures/entity/enchanting_table_book_blue.png"); + private static final ResourceLocation NORMAL = new ResourceLocation("unicopia", "textures/entity/enchanting_table_book.png"); public RenderSpellbook(RenderManager rendermanagerIn) { super(rendermanagerIn, new ModelSpellbook(), 0); @@ -19,7 +20,7 @@ public class RenderSpellbook extends RenderLiving { @Override protected ResourceLocation getEntityTexture(EntitySpellbook entity) { - return texture; + return entity.getIsAltered() ? BLUE : NORMAL; } @Override diff --git a/src/main/resources/assets/unicopia/textures/entity/enchanting_table_book.png b/src/main/resources/assets/unicopia/textures/entity/enchanting_table_book.png new file mode 100644 index 0000000000000000000000000000000000000000..6f0afa4f2f9050431baa483ddd0f65f1f6ac03cd GIT binary patch literal 1015 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3-p)I`?e@QY`6?zK#qG8~eHcB(gFvFf#=B zgt!95%l(wLSDF65!O+*&H)F<(wQJYz*|X>N*?ku-TzLQfJy5|Y7!85p8Uh?XvBE&V zE%J164DmSrcG5$)VU~dpvo>CN11BNyX!uACpStO>NI9 z#vu$A&ps@zi}9EIkba?3=0M%q1eFB#jiMer&f|Yy nvrKxT7CG;0S<|Nv9}4vI+b46qZ%7LN1d0hyS3j3^P6 zgNS;ljpRUNQ_!1EchA0iI_Wfcc=|{aQj`^(vDr3pFdRmJ@PAVNG^l+_&} zp%3B@n{D&*cn@7+m?q@;_487=D62FfZ|@D3hwW@J;WX$8jyCuH0CD8vjh7Ve56~lq zZAf_66@)l)wanXhpbbgUfva@(*#Wfx9PL=fuw@6-Wr=8;M)e>-tD*b4f9^n<5H%z8 zVY6*6Ri7p#^n0B`MOkHwiS&@+`uG@CKV;HV*d+!4uv{(`jQM=thI2d~6$H=oObN*I zd^Ve5S6$cR@fdp;V_ME`x1*E-z-qM;1^{r|oB&5;!UngcrJ6%2l|G@A{&pIfLOhKW zz`HmajkKIB%lPt7j`1;iDGm2C#