EntityType's can now say if the entity is immune to fire, the builder has been update to support this.
Mainly mapping updates
This commit is contained in:
modmuss50 2019-03-27 18:51:05 +00:00
parent 163d37cd42
commit 240d8ab775
6 changed files with 19 additions and 13 deletions

View file

@ -26,8 +26,8 @@ targetCompatibility = 1.8
archivesBaseName = "fabric" archivesBaseName = "fabric"
def baseVersion = "0.2.5" def baseVersion = "0.2.6"
def mcVersion = "19w12b" def mcVersion = "19w13a"
def ENV = System.getenv() def ENV = System.getenv()
version = baseVersion + "." + (ENV.BUILD_NUMBER ?: "local") version = baseVersion + "." + (ENV.BUILD_NUMBER ?: "local")
@ -38,7 +38,7 @@ minecraft {
dependencies { dependencies {
minecraft "com.mojang:minecraft:$mcVersion" minecraft "com.mojang:minecraft:$mcVersion"
mappings "net.fabricmc:yarn:$mcVersion.1" mappings "net.fabricmc:yarn:$mcVersion.2"
modCompile "net.fabricmc:fabric-loader:0.3.7.109" modCompile "net.fabricmc:fabric-loader:0.3.7.109"
} }

View file

@ -42,6 +42,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
private int trackingDistance = -1; private int trackingDistance = -1;
private int updateIntervalTicks = -1; private int updateIntervalTicks = -1;
private boolean alwaysUpdateVelocity = true; private boolean alwaysUpdateVelocity = true;
private boolean immunteToFire = false;
private EntitySize size = EntitySize.resizeable(-1.0f, -1.0f); private EntitySize size = EntitySize.resizeable(-1.0f, -1.0f);
protected FabricEntityTypeBuilder(EntityCategory category, EntityType.class_4049<T> function) { protected FabricEntityTypeBuilder(EntityCategory category, EntityType.class_4049<T> function) {
@ -75,6 +76,11 @@ public class FabricEntityTypeBuilder<T extends Entity> {
return this; return this;
} }
public FabricEntityTypeBuilder<T> setImmuneToFire() {
this.immunteToFire = true;
return this;
}
/** /**
* @deprecated Use {@link FabricEntityTypeBuilder#size(EntitySize)} * @deprecated Use {@link FabricEntityTypeBuilder#size(EntitySize)}
*/ */
@ -106,7 +112,7 @@ public class FabricEntityTypeBuilder<T extends Entity> {
// TODO: Flesh out once modded datafixers exist. // TODO: Flesh out once modded datafixers exist.
} }
EntityType<T> type = new EntityType<T>(this.function, this.category, this.saveable, this.summonable, null, size); EntityType<T> type = new EntityType<T>(this.function, this.category, this.saveable, this.summonable, this.immunteToFire, null, size);
if (trackingDistance != -1) { if (trackingDistance != -1) {
EntityTrackingRegistry.INSTANCE.register(type, trackingDistance, updateIntervalTicks, alwaysUpdateVelocity); EntityTrackingRegistry.INSTANCE.register(type, trackingDistance, updateIntervalTicks, alwaysUpdateVelocity);
} }

View file

@ -62,10 +62,10 @@ public class FabricCreativeGuiComponents {
minecraftClient.getTextureManager().bindTexture(BUTTON_TEX); minecraftClient.getTextureManager().bindTexture(BUTTON_TEX);
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.color4f(1F, 1F, 1F, 1F); GlStateManager.color4f(1F, 1F, 1F, 1F);
this.drawTexturedRect(this.x, this.y, (type == Type.NEXT ? 12 : 0), (active ? 0 : 12), 12, 12); this.blit(this.x, this.y, (type == Type.NEXT ? 12 : 0), (active ? 0 : 12), 12, 12);
if(mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height){ if(mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height){
gui.drawTooltip(I18n.translate("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, ((ItemGroup.GROUPS.length - 12) / 9) + 2), mouseX, mouseY); gui.renderTooltip(I18n.translate("fabric.gui.creativeTabPage", extensions.fabric_currentPage() + 1, ((ItemGroup.GROUPS.length - 12) / 9) + 2), mouseX, mouseY);
} }
} }
} }

View file

@ -110,8 +110,8 @@ public abstract class MixinCreativePlayerInventoryGui extends AbstractPlayerInve
} }
} }
@Inject(method = "onInitialized", at = @At("RETURN")) @Inject(method = "init", at = @At("RETURN"))
private void onInitialized(CallbackInfo info) { private void init(CallbackInfo info) {
fabric_updateSelection(); fabric_updateSelection();
int xpos = left + 170; int xpos = left + 170;

View file

@ -66,7 +66,7 @@ public abstract class MixinMinecraftClient {
// I don't like that we clone vanilla logic here, but it's our best bet for now. // I don't like that we clone vanilla logic here, but it's our best bet for now.
PlayerInventory playerInventory = client.player.inventory; PlayerInventory playerInventory = client.player.inventory;
if (client.player.abilities.creativeMode && Screen.isControlPressed() && client.hitResult.getType() == HitResult.Type.BLOCK) { if (client.player.abilities.creativeMode && Screen.hasControlDown() && client.hitResult.getType() == HitResult.Type.BLOCK) {
BlockEntity be = client.world.getBlockEntity(((BlockHitResult) client.hitResult).getBlockPos()); BlockEntity be = client.world.getBlockEntity(((BlockHitResult) client.hitResult).getBlockPos());
if (be != null) { if (be != null) {
stack = addBlockEntityNbt(stack, be); stack = addBlockEntityNbt(stack, be);

View file

@ -54,7 +54,7 @@ public class ContainerModClient implements ClientModInitializer {
@Override @Override
protected void drawBackground(float v, int i, int i1) { protected void drawBackground(float v, int i, int i1) {
fontRenderer.draw(pos.toString(), width / 2, height / 2, 0); font.draw(pos.toString(), width / 2, height / 2, 0);
} }
} }
@ -71,7 +71,7 @@ public class ContainerModClient implements ClientModInitializer {
@Override @Override
protected void drawBackground(float v, int i, int i1) { protected void drawBackground(float v, int i, int i1) {
fontRenderer.draw(pos.toString(), width / 2, height / 2, 0); font.draw(pos.toString(), width / 2, height / 2, 0);
} }
} }
@ -87,8 +87,8 @@ public class ContainerModClient implements ClientModInitializer {
@Override @Override
protected void drawBackground(float v, int i, int i1) { protected void drawBackground(float v, int i, int i1) {
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
client.getTextureManager().bindTexture(BG_TEXTURE); minecraft.getTextureManager().bindTexture(BG_TEXTURE);
this.drawTexturedRect(left, top, 0, 0, width, height); this.blit(left, top, 0, 0, width, height);
} }
} }